#K32757. Find the Basketball Champion
Find the Basketball Champion
Find the Basketball Champion
In a knockout basketball championship, N teams compete in a series of matches. In each match, one team wins and the other loses. The champion is the team that never loses a match. It is guaranteed that there is exactly one team which never lost in the tournament.
You are given an integer \(N\) representing the number of teams, and an integer \(M\) representing the number of matches, followed by \(M\) lines each containing two integers: the first integer is the identifier of the winning team and the second integer is the identifier of the losing team.
Your task is to determine the champion team (i.e. the team that was never recorded as losing any match).
inputFormat
The input is read from standard input (stdin) and consists of:
- The first line contains two integers \(N\) and \(M\) where \(N\) is the number of teams and \(M\) is the number of matches.
- The following \(M\) lines each contain two integers \(a\) and \(b\) representing a match result, where \(a\) is the winner and \(b\) is the loser.
outputFormat
Output the identifier of the team which never lost a match to the standard output (stdout).
## sample4 3
1 2
3 4
1 3
1