#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<iostream>
#define ss second
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define ff first
#define en end
#define be begin
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ve vector
using namespace __gnu_pbds;
using namespace std;
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
long long value(int r,int c);
std::pair<int,int> find_locmin_point(int N,int M){
    int x=value(1,1);
    int l=1, r=N;
    while (l<r){
        int md=(l+r+1)/2;
        if (value(1,md)<x) l=md;
        else r=md-1;
    }
    return {1,l};
}