A presidential election is being held in a small country. There are M citizens voting among N candidates labeled from 1 to N.
Each voter writes all candidates in order of preference: their favorite candidate first, their second favorite second, and their least favorite last.
Candidate A defeats candidate B if more voters placed A before B than placed B before A. The score of a candidate is the number of other candidates they defeated. A candidate is an election winner if their score is greater than or equal to every other candidate's score.
Given all voters' ballots, find the winner or winners of the election.
The first line contains two integers M and N. They satisfy 1 <= M, N <= 50, and M is odd.
Each of the next M lines contains one voter's ballot: a permutation of the numbers from 1 to N, listed from most preferred to least preferred.
If there is exactly one winner, print that candidate's label on the only line.
If there is more than one winner, print each winner's label on its own line. The winners may be printed in any order.