Competitions

# ADA Classes - November 20

# Cycles in the graph

Given an undirected graph without loops and multiple edges. Determine whether there are cycles in the graph, and, if so, find the vertex with the smallest number belonging to at least one of the cycles.

#### Input

The first line contains two integers **n** and **k** (**1** ≤ **n** ≤ `10`

, ^{5}**0** ≤ **k** ≤ `10`

) - the number of vertices and edges in the graph. Followed by ^{5}**k** lines, each contains a pair of distinct integers **a**, **b** (**1** ≤ **a**, **b** ≤ **n**) which means that there is an edge in the graph between the vertices **a** and **b**. Each pair of **a**, **b** does not occur more than once.

#### Output

If the graph contains no cycles, print a single word **No**. Otherwise, print in the first line **Yes** and in the next line print the smallest number of vertex belonging to at least one cycle.

Input example #1

6 6 1 2 2 3 3 4 4 5 5 2 4 6

Output example #1

Yes 2