include<bits/stdc++.h>
using namespace std;
std::pair<int, int> find_locmin_point(int N, int M){
    long long a[N+5][M+5];
    bool ok;
    for(int i=1;i<=N;i++)
        for(int j=1;j<=M;j++)
        a[i][j]=value(i,j);
    for(int i=1;i<=N;i++)
    for(int j=1;j<=M;j++){
        ok=1;
        if(i>1)if(a[i][j]>a[i-1][j])ok=0;
        if(i<N)if(a[i][j]>a[i+1][j])ok=0;
        if(j>1)if(a[i][j]>a[i][j-1])ok=0;
        if(j<M)if(a[i][j]>a[i][j+1])ok=0;
        if(ok==1)return{i,j};
    }
}