Time limit
1s
Memory limit
128 MB
Let T be a rooted tree, and let S be an exact copy of T. For every leaf of T except the root, identify that leaf with the corresponding leaf of S. The graph obtained this way is called a mirror-symmetric tree graph.
Given an undirected connected graph, determine whether it is a mirror-symmetric tree graph.

The first line contains two integers N and M, the number of vertices and the number of edges. The vertices are numbered from 1 to N.
Each of the next M lines contains two integers x and y, describing one edge. The vertices x and y are distinct, and there is at most one edge between any pair of vertices.
Print YES if the given graph is a mirror-symmetric tree graph. Otherwise, print NO.