Our brave Magicpig went to explore again! This time he was trapped in a labyrinth! This labyrinth consists of n rooms numbered from 1 to n. There are some tunnels connecting these rooms. But note that all the tunnels are one-way! That means if there is a tunnel connecting room i and room j, you can only move from room i to room j through this tunnel and it is impractical conversely. Magicpig was in room 1. On the wall of the room there were some ancient Egyptian characters: "The only exit is in this room. If you leave this room, the door of the exit will open. Once this door is opened, it won't close again. " Can Magicpig escape from this labyrinth?


The input contains one or more data sets. At first line of each input data set there is two integers n and m, where n is the number of rooms and m is the number of the tunnels. The next m lines contain integer pairs i and j, which indicate that there is a tunnel between room i and room j and you can only move from room i to room j through this tunnel.

Zero at line for number of rooms terminates the input for your program.


For each data set, if Magicpig can escape, print a string "YES", else print "NO".

Sample Input

3 3
1 2
2 3
3 1


Sample Output


Note: In the sample input, Magicpig first moves to room 2, then the door will open. Now Magicpig can move to room 3 and then room 1 and escapes successfully!.

Author: Mathematica