#include <bits/stdc++.h>
using namespace std;
int main()
{
    ifstream f1("yenngua.inp");
    ofstream f2("yenngua.out");
    long i,j;
    f1 >> i >> j;
    long a[i][j];
    for (long b = 0; b < i; b++)
    {
        for (long c = 0; c < j; c++) f1 >> a[b][c];
    }
    for (long n = 0; n < i; n++)
    {
        for (long m = 0; m < j; m++)
        {
            int k = 0;
            for (long x = 0; x < i; x++)
            {
                if (x == n) continue;
                if (a[n][m] < a[x][m]) k = 1;
            }
            for (long y = 0; y < j; y++)
            {
                if (y == m) continue;
                if (a[n][m] > a[n][y]) k = 1;
            }
            if (k == 0) f2 << n << m;
        }
    }
    return 0;
}
