#include <iostream>
#include "code.h"
#include <bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;a++)
#define Ford(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define ll long long
#define piii pair<int,pair<int,int> >
#define se second
#define fi first
using namespace std;
const int MAX=1e3+5;
int a[MAX][MAX],maxx[MAX],idv[MAX],idk[MAX],minn[MAX];


std::vector<int> Nadji(int N, int K)
{
    std::vector<int> sol;
    For(i,1,N)
        For(j,1,N)
        {
            a[i][j]=Pitaj(i,j);
        }
    For(i,1,N)
    {
        maxx[i]=0;
        For(j,1,N)
        {
            if (a[i][j]>maxx[i])
            {
                maxx[i]=a[i][j];
                idv[i]=1;
            }
            else if (a[i][j]==maxx[i])
            {
                idv[i]++;
            }
        }
    }
     For(j,1,N)
    {
        minn[j]=1e9+7;
        For(i,1,N)
        {
            if (a[i][j]<minn[j])
            {
                minn[j]=a[i][j];
                idk[j]=1;
            }
            else if (a[i][j]==minn[j])
            {
                idk[j]++;
            }
        }
    }
    For(i,1,N)
    {
        For(j,1,N)
        {
            if (a[i][j]==maxx[i] && idv[i]==1 && a[i][j]==minn[j] && idk[j]==1)
            {
                sol.pb(i);
                sol.pb(j);
                return sol;
            }
        }
    }
    sol.pb(0);
    sol.pb(0);
    return sol;

}