Secret Santa

Secret Santa is a very popular game in which a group of people gives presents to each other in special dates, like Christmas. The organizer writes the names of each of the participants in a ballot paper and introduces them in a bag. One by one, each person takes a paper, which contains the name of the person to which they will have to give a present. If a person gets their own name, the process will have to be repeated: being your own Secret Santa ruins the game, as it is way less interesting. Parents of little Samuel have offered him to organize a familiar Secret Santa, and he has to make a present to his mom. He has been confused for days because, even if he still can’t explain why, he suspects that his mom is his dad’s Secret Santa and that his dad is his own Secret Santa. Sadly, this game seems to not be funny at all when there is only three people playing. He have been talking about all that with his cousin Alana, who has also played Secret Santa at home with her parents and her sister Irene. Alana had to make a present to her mom. . . who asked her for help in choosing a present for Irene, because she was her Secret Santa. Alana could not explain why, but she also knew all the Secret Santa in her family. It’s obvious that this game is not funny at all. Why is it called Secret Santa if it’s possible to guess the assignation so easily? Input The program has to read, from the standard input, several test cases, each of them related to a different Secret Santa among a group of people. The first line of each test case contains two numbers. The first one 2 ≤ p ≤ 50 indicates the number of participants taking part in the Secret Santa round. The second number 1 ≤ a ≤ 50 indicates the number of assignations known by each of the participants, by their own ballot paper or because they suspect or got a direct confession from someone else. After that, a lines will indicate each of the known assignations. Each of the assignations will be provided with two numbers, the first one indicating the person that is giving a present, and the second one to whom they are giving it. Participants are numbered from 1 to p. Input finishes with a test case without participants, which will not be processed. Output For each test case, the program has to write ‘YES’ if it’s possible to know, without any possibility of errors, the assignation of all the participants of the Secret Santa, and ‘NO’ otherwise. Sample Input 31 12 42 12 23 42 12

2/2 43 00 Sample Output YES YES NO