Regular graph
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Undirected graph is called regular, if all its vertices have the same degree.
Graph is given by list of edges. Check, is it regular.
Input
First line contains number of vertices and number of edges in a graph. Then given pairs of numbers — the edges of graph.
Output
Print "YES" if graph is regular and "NO" otherwise.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 6K
Acceptance rate 61%