LCC '22 Contest 2 J2 - Burj Kha-leaf-a

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 128M

Author:
Problem type

The Burj Khalifa is the tallest building in the world. Standing 828 meters above the ground, it is over 2.5 times the height of the Eiffel Tower and nearly 150 meters taller than the world's next-tallest building.

Aaron has a list of N buildings from around the world, numbered from 1 to N. He knows the Burj Khalifa is one of these buildings, and he decides to compare the heights between buildings to find which numbered building corresponds to the Burj.

His comparison process consists of M total comparisons, each of which is between two buildings A_i and B_i, where building A_i is taller than building B_i. Building B_i will then no longer appear in any subsequent comparisons, as Aaron knows it cannot be the tallest building. It is guaranteed that after all buildings are compared, one building can be determined to be taller than the rest.

Using the results from Aaron's comparison process, can you determine which number corresponds to the Burj Khalifa?

Constraints

1 \le N \le 10^5

1 \le M \le 10^5

1 \le A_i, B_i \le N

Input Specification

The first line of input will contain two integers, N and M.

The next M lines of input will each contain two integers, A_i and B_i.

Output Specification

Output one integer, the building number that corresponds to the Burj Khalifa.

Sample Input

5 4
1 2
3 4
1 3
5 1

Sample Output

5

Comments

There are no comments at the moment.