Bipartite Check


You are given an undirected graph with nn vertices and mm edges. The graph may be disconnected.

Determine whether every connected component can be colored using two colors so that every edge joins two vertices of different colors.

Input

The first line contains two integers nn and mm.

The next mm lines each contain two integers aa and bb, meaning there is an undirected edge between vertices aa and bb.

Vertices are numbered from 11 to nn.

Output

Print YES if the graph is bipartite. Otherwise, print NO.

Constraints

  • 1≤n≤2000001 \le n \le 200000
  • 0≤m≤3000000 \le m \le 300000
  • 1≤a,b≤n1 \le a, b \le n

Example 1

Input 1
4 4
1 2
2 3
3 4
4 1
Output 1
YES
Explanation

The graph is a cycle of even length, so alternating the two colors around the cycle works.

Example 2

Input 2
3 3
1 2
2 3
3 1
Output 2
NO
Explanation

The graph is a triangle, so two adjacent vertices must eventually receive the same color.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.