#bzoj2350. Tree Mirroring

Tree Mirroring

Problem Description

image1

Input format

The first line consists of two integers, nn and mm, representing the number of points and edges in a given graph.

Next, in the mm rows, two numbers uu and vv represent an edge in the graph, ensuring that there are no duplicate edges or self loops.

Output format

Output a string YES or NO to indicate whether the image is a tree-mirrored graph.

Samples

7 7
1 2
2 3
3 4
4 5
5 6
6 7
7 1
NO

Data scale and agreement

For 30%30\% of the data:3n,m3003\le n,m\le 300;

For 60%60\% of the data:3n,m3.5×1033\le n,m\le 3.5\times 10^3;

For all of the data:3n,m1053\le n,m\le 10^5.