#00000F

trubaci

The best trumpet player of Dragacevo is chosen at Gucha assembly. There are N trumpet players in the competition and each of them has a unique number between 1 and N. Here are the rules of the competition: In the first round, the players with numbers 1 and 2 compete and the judges choose the winner. The winner form the first round passes to the second round where he competes with player #3. The winner from the second round competes with player #4, etc. In round N-1, the winner from the previous round competes with the player with number N. The winner of the last round is the overall winner.


There are M judges in the competition. Every judge has already heard all of the competitors and has the list with their numbers. Each judge would prefer that the winner of the competition be the player with the best rank on their list. Due to the jolly atmosphere of the assembly, every judge has seen the lists of all other judges. In every round the judges vote in a way such that the overall winner is the competitor who is ranked as highest on their personal list. Your program needs to determine the number of the player who wins the competition.


InputThe first line of the standard input contains two numbers N and M (N<=50, M<50, M is an odd number). Each of the following M lines contains N numbers such that line i+1 contains the list of judge i. The first number in every line represents the number of the highest ranking competitor on the list of judge i.

OutputWrite one number to the standard output that represents the number of the player who wins the competition.

Input:
3 3
1 2 3
2 3 1
3 1 2

Output:
2
Explanation: There are 3 judges and 3 competitors. The list of the first judge is 1, 2, 3; the list of the second is 2, 3, 1 and of the third is 3, 1, 2. If the winner of the first round was contestant 1, then the overall winner would be contestant 3 (the second and third judges are against contestant 1). If the winner of the first round was contestant 2, then they would also be the overall winner. Hence, the judges know that voting for competitor 1 in the first round leads to the choosing of contestant 3 for the overall winner and that voting for contestant 2 leads to choosing them for the overall winner. Since most of the judges have contestant 2 ranked higher than contestant 3, they will choose him as the winner of the first round and, therefore, as the overall winner.

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.