#include "locmin.h"
#include "bits/stdc++.h"
using namespace std;

#define ll long long
const ll INF=1e18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

pair<int,int>find_locmin_point(int N,int M)
{
      vector<vector<ll>>a(N+2,vector<ll>(M+2,INF+1));
      vector<pair<int,pair<int,int>>>srt;
      for(int i=1;i<=min(150,N*M);i++){
            int x=rng()%N+1;
            int y=rng()%M+1;
            srt.push_back({value(x,y),{x,y}});
      }
      sort(srt.begin(),srt.end());
      return {srt[0].second.first,srt[0].second.second};
}
