eolymp
bolt
Try our new interface for solving problems
Problems

Regular graph

Regular graph

Undirected graph is called \textbf{regular}, if all its vertices have the same degree. Graph is given by list of edges. Check, is it regular. \InputFile First line contains number $n~(1 \le n \le 100)$ of vertices and number $m~(m \le n \cdot (n - 1) / 2)$ of edges in a graph. Then given $m$ pairs of numbers --- the edges of graph. \OutputFile Print "\textbf{YES}" if graph is regular and "\textbf{NO}" otherwise. \includegraphics{https://static.e-olymp.com/content/dc/dcd4c29100bedb8c5e5e23e4516b5f260f9aae44.gif}
Time limit 1 second
Memory limit 128 MiB
Input example #1
3 3
1 2
1 3
2 3
Output example #1
YES
Input example #2
3 2
1 2
2 3
Output example #2
NO