9172 - Is it a forest?   

Description

Given a graph, output "Yes" if it's a forest, otherwise "No".
Forest's definition : forest is a set that made up by T tree(s). (T>=0)

Input

For each case, The first line contains two positive integers N and M (2 <= N <= 10000000), and N denotes the number of node. In the next M lines, there will be two integers A and B, denoting the two end points of an edge (A, B).
A,B>=1 , A,B<=N
Each case is separated by a blank line. The input is terminated by two zeros in place of N and M.

Output

For each case a line, output "Yes" if it's a forest, otherwise "No".

Sample Input  Download

Sample Output  Download

Tags




Discuss