Under construction

Still being built. Things may change

Who is the final winner?

Interview

Time limit1sMemory limit128 MB

Summary
Each of N players holds M cards; every round all players play their largest remaining card and whoever plays the highest value scores a point. Report the player(s) with the most points.
Level

Easy3 of 10

Topics
Sorting, Simulation, Implementation, Array
Solved
No attempts yet

Problem

After many tournament rounds, NN players are left. Each player holds MM cards, and every card has a number written on it.

On each turn every player puts down the largest card still in their hand, and the player who put down the largest number gains 1 point. Several players can put down that largest number, and in that case each of them gains 1 point. The cards used on a turn are discarded.

After MM turns, which player has gained the most points?

Input

The first line has the number of players NN and the number of cards each player holds MM, separated by a space. (2≤N≤1002 \le N \le 100, 1≤M≤1001 \le M \le 100)

Each of the next NN lines has the MM numbers written on one player's cards. Writing a card number as cc, 1≤c≤1001 \le c \le 100. The numbers on a line come in no fixed order.

Output

Print the number of the final winner. Players are numbered 1 to NN in the order they are given.

If several players have gained the most points, print their numbers in ascending order on one line, separated by a single space.

Examples5

  1. Example 1

    Input
    5 3
    5 4 3
    2 5 1
    3 3 3
    2 2 2
    1 1 1
    
    Expected output
    1
    
  2. Example 2

    Input
    5 3
    5 4 3
    3 4 5
    3 5 4
    4 5 3
    3 4 4
    
    Expected output
    1 2 3 4
    
  3. Example 3

    Input
    2 1
    1
    100
    
    Expected output
    2
    
  4. Example 4

    Input
    2 1
    50
    50
    
    Expected output
    1 2
    
  5. Example 5

    Input
    3 4
    1 100 2 3
    100 1 1 1
    4 4 4 4
    
    Expected output
    3