Олимпиадный тренинг

Задача 44616. saddle point


Saddle point – is the element of the matrix that is both the largest in its column and the smallest in its row. Write a program that finds the indices of all saddle points of a matrix. The numbering of rows and columns of the matrix starts from one.

 

Input

The first line contains space-separated dimensions of a rectangular matrix N and N (number of rows and number of columns, 1  <=  ;N, M <=  100). The following N lines contain matrix rows, each – by M natural numbers separated by spaces.
 

Output

The program should output the indexes of all saddle points of the matrix in row order (top to bottom, left to right). The row number and column number of each saddle point are separated by spaces. The numbering starts from one. If there is no saddle point in the matrix, you need to print the number 0.

 
Examples
# Input Output
1
4 5
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
9 17 18 19 20
3 1