Check if a Graph Is a Linked List

Given an undirected graph with v vertices and e edges, you are asked to determine if the graph is actually a linked list.
notion image

Input

The first line of the input contains two integers v (1 ≀ v ≀ 100 000) and e (1 ≀ e ≀ 100 000).
The following e lines contain pairs of integers v1, v2 (1 ≀ v1, v2 ≀ v) which means that the vertex v1 is connected to the vertex v2 and vice versa.

Output

The program should print Yes if the graph is a linked list and No otherwise.

Examples

Input
Output
6 5 3 2 2 1 5 6 4 6 1 4
Yes
6 4 3 2 2 1 5 6 4 6
No
Β 

Constraints

Time limit: 4 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue