#include "code.h"
#include <bits/stdc++.h>
std::vector<int> Nadji(int N, int K)
{
    int pl[1005][1005],minkol[1005],maxred[1005];
    bool n1[1005],n2[1005],f=true;
    	std::vector<int> out;
    for (int i=1;i<=1000;i++){
        minkol[i]=999999999;

    }

    if (N*N==K){
    for (int i=1;i<=N;i++){
                for (int j=1;j<=N;j++){
                    pl[i][j]=Pitaj(i,j);
                 if (maxred[i]<pl[i][j] and !n1[i]){
                   maxred[i]=pl[i][j];
                 }
                  if (maxred[i]==pl[i][j]){
                    maxred[i]=0;
                    n1[i]=true;
                  }
                  if (minkol[j]>pl[i][j] and !n2[i]){
                    minkol[j]=pl[i][j];
                 }
                    if (minkol[i]==pl[i][j]){
                    minkol[i]=0;
                    n2[i]=true;
                  }
             }
          }
     for (int i=1;i<=N;i++){
           for (int j=1;j<=N;j++){
            if (maxred[i]==minkol[j]){
                out.push_back (i);
                out.push_back (j);
                f=false;
                break;
            }
           }
           if (!f){break;}
          }
}
if (f){
  	out.push_back(0);
	out.push_back(0);
}
	return out;
}