#include <bits/stdc++.h>

using namespace std;

map<int,long long> was;
long long value(int r, int c);
long long get (int x) {
    if (was.find (x) == was.end ()) return was[x] = value (1, x);
    else return was[x];
}
long long A[505][505];
long long g (int i, int j, int N, int M) {
    if (i < 1 || i > N || j < 1 || j > M) return 1e18 + 52;
    if (A[i][j]) return A[i][j];
    return A[i][j] = value (i, j);
}
std::pair<int, int> find_locmin_point(int N, int M) {
    if (N == 1) {
        was.clear();
        if (N == 1 && M == 1) return {1, 1};
        int l = 1, r = M;
        while (l < r) {
            int mid = (l + r) >> 1;
            long long x = get (mid);
            if (mid == M) {
                long long y = get (mid - 1);
                if (y > x) {
                    return {1, M};
                } else r = mid - 1;
            } else {
                long long y = get (mid + 1);
                if (y < x) {
                    l = mid + 1;
                } else {
                    if (mid == 1) {
                        return {1, mid};
                    }
                    long long z = get (mid - 1);
                    if (z > x) return {1, mid};
                    else r = mid - 1;
                }
            }
        }
        return {1, l};
    } else {
        for (int i = 1; i <= N; ++i) {
            for (int j = 1; j <= M; ++j) A[i][j] = 0;
        }
        for (int i = 1; i <= N; ++i) {
            for (int j = 1; j <= M; ++j) {
                int mn = min ({g (i - 1, j, N, M), g (i + 1, j, N, M), g (i, j - 1, N, M), g (i, j + 1, N, M)});
                if (g (i, j, N, M) < mn) {
                    return {i, j};
                }
            }
        }
        return {1, 1};
    }
}
#ifdef LOCAL
#include<iostream>
using namespace std;
static const int MAXN=500,MAXM=500;
static long long int tab[MAXN][MAXM];
static int n,m;
static void finish (string message) {
    cout << message << endl ;
    exit(0);
}

static int cnt=0;
long long int value (int row, int col) {
    row--; col--;
    if ((row<0)||(row>=n)||(col<0)||(col>=m)) finish("Invalid row or column number in question ("+to_string(row)+","+to_string(col)+")!");
    cnt++;
    if (cnt>n*m) finish("Too many questions!");
    return tab[row][col];
}
extern pair <int, int> find_locmin_point (int, int);

static int drow[]={ -1, -0, +0, +1 };
static int dcol[]={ -0, -1, +1, +0 };
static bool check_saddle (int row, int col) {
    for (int i=0; i<4; i++) {
        int r=row+drow[i],c=col+dcol[i];
        if ((r<0)||(r>=n)||(c<0)||(c>=m)) continue;
        if (tab[r][c]<=tab[row][col]) return false;
    }
    return true;
}
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m ;
    for (int i=0; i<n; i++) {
        for (int j=0; j<m; j++) {
            cin >> tab[i][j] ;
        }
    }
    auto [r, c]=find_locmin_point(n,m);
    cout << "Answer cell: (" << r << "," << c << ")\n";
    cout << "Number of value calls: " << cnt << endl ;
    r--; c--;
    if ((r<0)||(r>=n)||(c<0)||(c>=m)) finish("Invalid row or column in answer!");
    if (check_saddle(r,c)==false) finish("Answer is not a local minimum point!");
    finish("Correctly found local minimum point.");
    return 0;
}

#endif // LOCAL
//signed main() {
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//#ifdef LOCAL
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//#endif // LOCAL
//
//    return 0;
//}
