407632: GYM102861 K Between Us

Memory Limit:1024 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Between Ustime limit per test0.25 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard output

Ties are usually an issue on elections and games. Recently, a new game, called Between Us, was created. The game is played by a number of players over a social network. On each turn, there are multiple votings, where a player may receive only votes from friends. The player getting the largest number of votes wins the game.

The game is still in its design phase, but the game developers faced a very common issue: since the number of friends of a given player is usually small, ties are very common, which makes the game less fun. To avoid this situation, they decided to add a new module to the match-making system, where it will try to form groups of players such that each player has an odd number of friends in the same group.

This problems turned out to be more challenging than they expected and they are now focusing on a simpler variation: given a set of players, the module must find a partition of the players in at most two groups, satisfying the restriction that each player must have an odd number of friends in his group. The problem is that this partition is not always possible. Your task is to determine whether the partition is possible.

Input

The first line of input contains two integers, $$$P$$$ and $$$F$$$, the number of players and the number of friendship relations, respectively, satisfying $$$2 \le P \le 100$$$ and $$$1 \le F \le P \times (P - 1)/2$$$. Each of the next $$$F$$$ lines will contain two integers $$$A$$$ and $$$B$$$, with $$$1 \le A, B \le P$$$ and $$$A \neq B$$$, meaning that players $$$A$$$ and $$$B$$$ are friends. Each friendship relation is given at most once, that is, if a line contains $$$A$$$ and $$$B$$$, no other line contains both numbers.

Output

Output a single line containing one character. If the partition is possible, then write the upper case letter 'Y'; otherwise write the uppercase letter 'N'.

ExamplesInput
4 4
4 2
1 3
2 3
1 4
Output
Y
Input
4 3
4 2
2 3
1 2
Output
Y
Input
5 5
3 5
3 1
1 4
2 5
2 4
Output
N

加入题单

上一题 下一题 算法标签: