eolymp
bolt
Try our new interface for solving problems
Problems

Byteland Tour

Byteland Tour

Mister X is going to visit Byteland and wants to make a tour of the country. There are some bidirectional roads between the cities. All roads connect different pairs of the cities. There is no road that connects a city with itself. Mister X hasn't already decided which city would be the first in his tour, though he has decided how he would move from one city to another. When he is in the city \textbf{A} he chooses any nonvisited city that can be directly reached from \textbf{A}, and moves to it. If there is no such city, he finishes his tour. Mister X wants to know if any of his possible routes (independent from choosing starting city and next nonvisited cities) contains all the cities. Your task is to help him. \InputFile The first line of the input file contains two integers \textbf{N} and \textbf{M} (\textbf{1} ≤ \textbf{N} ≤ \textbf{100000}, \textbf{0} ≤ \textbf{M} ≤ \textbf{200000}): the number of cities and the number of roads in Byteland. Each of the next \textbf{M} lines contains two integers: the numbers \textbf{a_i}, \textbf{b_i} (\textbf{1} ≤ \textbf{a_i}, \textbf{b_i} ≤ \textbf{N}) of two cities connected by road. All the roads connect different pairs of the cities. \OutputFile In the single line of the output file print \textbf{YES} if every Mister X's route contains all \textbf{N} cities, otherwise print \textbf{NO}.
Time limit 1 second
Memory limit 256 MiB
Input example #1
3 3
1 2
2 3
3 1
Output example #1
YES