Consider an undirected graph G=(V,E). For a vertex v, write N(v) for the set of vertices adjacent to v, and write deg(v) for the size of that set, the degree of v.
Call G strange if it is connected and every vertex v meets all of these conditions.
A Hamiltonian cycle passes through every vertex of G exactly once, so its last vertex is adjacent to its first vertex.
You are given a strange graph G. Decide whether it has a Hamiltonian cycle.
The first line contains two integers N and M, the number of vertices and the number of edges of G (3≤N≤10000, M≤100000).
Then 2M integers follow. Taken in order, each consecutive pair gives the two endpoints of one edge. Vertices are numbered from 1 to N. The numbers are separated by spaces or line breaks, and the split into lines is not fixed. Every edge appears exactly once, and the two endpoints of an edge are always different. G is guaranteed to be strange.
Print YES if G has a Hamiltonian cycle, and NO otherwise.