402222: GYM100703 E Dragons in sleeping

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Dragons in sleepingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

— And do dragons do the same when they want to get married? — Princess asked.

— Dragons live alone. They come in existence in people's minds. And they evanesce when people forget about them, — Dragon answered.

Dragon told Princess that when someone imagines a new dragon, a new castle appears in the Castles Valley in which the dragon lives. If nobody thinks about the dragon for a long time, he falls asleep.

Sometimes it unusual rains in the Castles Valley. There is no clouds in the sky, the sun shines brightly, but great raindrops knock frequently on the roof of the castle where dragon sleeps. And after the rain is over, a lawn with wildflowers appears in the place where the castle was before. Moreover, rainwater brooks flow along the lanes leading from this castle. If a brook reaches a castle of a waking dragon, it stops there. However, if it reaches a castle of sleeping dragon, this castle becomes a lawn, too, and a brook flows farther.

Although dragons are only dreams, they feel for sleeping ones. They learned to foresee such rains, but they don't know which castle this rain will spill on. At the same time dragons want the number of appeared lawns to be as minimum as possible. They have a time to wake up exactly one of sleeping dragons before the rain. Now they want to know, in which castle they should wake up a dragon. Your task is to find it.

For the sake of simplicity, the input contains castles with sleeping dragons only. Also it is guaranteed that a path (consisting of one or more lanes) between every two castles exists.

Input

The first line contains integers n and m (1 ≤ n ≤ 105,  1 ≤ m ≤ 2·105) — the number of castles with sleeping dragons and the number of lanes between castles.

Each of the next m lines contains two integer — numbers of castles connected by the lane.

It is guaranteed that no more than one lane between any two castles exist. Also no one lane connects a castle with itself.

Output

Print the only integer — number of a castle in which dragon should be woken up.

If there is more then one answer, output any of them.

ExamplesInput
6 7
1 2
1 3
2 4
3 4
4 5
4 6
5 6
Output
4
Input
4 4
1 2
2 3
3 4
4 1
Output
1

加入题单

算法标签: