11676 - Eulerian_circle   

Description

There are N different points , labeled from 1 to N. You are asked to draw a path connecting all the points to form a circle(環), and each point is allowed to be visited more than once. For example, the following 5 points can be connected into the shape of a circle in the order of 1,2,3,4,5,1 . 

It is promised that there exists a path from each point to all the other points.

You need a program to check whether the graph can be connected as a circle or not.

Input

There are several test cases, but no more than 10 test cases. In each test case, there’re two numbers N and M in the first line, indicating that there’re N points and M lines on the paper. Each line can be used only once.

In the next M lines, each line contains two numbers i and j, which means there’s a line connecting point i and point j.

   •     1 <= N <= 10^4

   •     N-1 <= M <= 10^5

   •     1 <= i, j <= N

   •     The given graph contains only one connected component which connects all the points. There’s not a single point that cannot reach all the other points.

Output

If the graph can be connected to form a circle, print Yes; otherwise, print No.

Sample Input  Download

Sample Output  Download

Tags




Discuss