Competitions

# DSU

# Connectivity

Check whether the given undirected graph is connected. That its possible to go from any vertex to any other along the edges of this graph.

#### Input

The first line contains the numbers **n** and **m** are separated by spaces - the number of vertices in the graph, respectively (**1** ≤ **n** ≤ **100**, **1** ≤ **m** ≤ **10000**). The following **m** lines contain two numbers `u`

and _{i}`v`

by a space (_{i}**1** ≤ `u`

, _{i}`v`

≤ _{i}**n**); each such line means that the graph there is an edge between vertices `u`

and _{i}`v`

._{i}

#### Output

Print "**YES**", if the graph is connected, and "**NO**" otherwise.

Input example #1

3 2 1 2 3 2

Output example #1

YES

Input example #2

3 1 1 3

Output example #2

NO