#include <bits/stdc++.h>
#define mp make_pair
#ifdef EVAL
#include "locmin.h"
#endif

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

ll lol[505][505];
#ifndef EVAL
int a[505][505];
ll value(int x, int y) {
    return a[x][y];
}
#endif
pii find_locmin_point(int n, int m) {
    int st = 1, dr = m;
    if(m == 1)
        return {1, 1};
    lol[1][st] = value(1, st);
    lol[1][dr] = value(1, dr);
    int q = 2;
    while(dr - st > 1) {
        int mij = (st + dr) / 2;
        if(!lol[1][mij]) {
            q++;
            assert(q <= 30);
            lol[1][mij] = value(1, mij);
        }
        if(lol[1][st] < lol[1][dr]) {
            if(lol[1][mij] < lol[1][st]) {
                if(!lol[1][mij-1]) {
                    assert(q <= 30);
                    lol[1][mij-1] = value(1, mij-1);
                }
                if(lol[1][mij-1] > lol[1][mij])
                    st = mij;
                else
                    dr = mij - 1;
            }
            else
                dr = mij;
        }
        else {
            if(lol[1][mij] < lol[1][dr]) {
                if(!lol[1][mij+1]) {
                    q++;
                    assert(q <= 30);
                    lol[1][mij+1] = value(1, mij+1);
                }
                if(lol[1][mij+1] > lol[1][mij])
                    dr = mij;
                else
                    st = mij + 1;
            }
            else
                st = mij;
        }
    }

    if(st == dr)
        return {1, st};
    if(!lol[1][st]) {
        q++;
        assert(q <= 30);
        lol[1][st] = value(1, st);
    }
    if(!lol[1][dr]) {
        q++;
        assert(q <= 30);
        lol[1][dr] = value(1, dr);
    }
    if(lol[1][st] < lol[1][dr])
        return {1, st};
    else
        return {1, dr};
}

#ifndef EVAL
int main() {
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=m; j++)
            cin >> a[i][j];
    auto [ansx, ansy] = find_locmin_point(n, m);
    cout << ansx << ' ' << ansy << ' ' << a[ansx][ansy];
    return 0;
}
#endif