Party Night#6918

Party Night

1 second
64 megabytes
Very easy

Today is the town's celebration day, when, by tradition, all townspeople take part in special events. Each of them attends a daytime event, where they meet, have fun, and make new friends. Later on, after these events end, a set of evening gatherings are held, and everyone goes to one of them as well. To help the villagers make as many acquaintances as possible, no two people attend both the same daytime and evening gatherings.

Naturally, after so many activities, everyone has a hard time recalling all the details of whom they met; yet people are curious about the social connections that formed. Unfortunately, all they remember is which other townspeople they have crossed paths with at an event, but not when or where. Even these memories might not be fully accurate, so they need your help to determine if the recollections can be logically consistent — or whether someone must have made a mistake (either by forgetting someone present, or thinking they met someone who was not actually there). Can you help them?

For example, in a town with people, suppose villagers , , and all recall meeting each other, and villagers and recall meeting as well. This information is consistent: there could have been daytime events E_0 and E_1, and evening events G_0, G_1, G_2, where person attended E_0 and G_0, person attended E_0 and G_1, person attended E_0 and G_2, and person attended E_1 and G_2; this configuration matches the given recollections. However, if persons and had also recalled meeting, the information could not be correct.

Input

The input file will contain several test cases. Each of them begins with a line containing two integers: 1 \leq n \leq 100, the number of villagers; and 0 \leq m \leq 1000. lines follow, each containing a pair of integers and , 0 \leq i, j < n, i \neq j, meaning that persons numbered and remember having met at an event. No pair will appear twice.

Different test cases will be separated by a blank line. A line with n = m = 0 signals the end of input.

Output

For each test case, print "YES" if there is a way to organize two sets of gatherings and assign villagers to them under the described conditions, such that the pairs of people who met each other are exactly those given in the input. Print "NO" otherwise.

Examples

Example 1

Loading
Loading