#include "code.h"
#include <bits\stdc++.h>

using namespace std;

int a[3010][3010];

std::vector<int> Nadji(int N, int K)
{

	std::vector<int> out;
    int n=N;
	for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            a[i][j]=Pitaj(i,j);
    /*cout<<endl;
	for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
            cout<<a[i][j]<<" ";
        cout<<endl;
    }*/
    for(int i=1;i<=n;i++)
    {
        int maxi=a[i][1];
        int ind=1;
        bool ok=true;
        for(int j=2;j<=n;j++)
            if(a[i][j]>maxi)
                maxi=a[i][j],ind =j, ok=true;
            else if(a[i][j]==maxi)
                ok=false;

        if(!ok) continue;

        //cout<<i<<" "<<ind<<" "<<maxi<<endl;

        ok=true;
        for(int k=1;k<=n;k++)
            if(k!=i && a[k][ind]<=maxi)
            {
                ok=false;
                break;
            }
        if(ok)
        {
            out.push_back(i);
            out.push_back(ind);
            return out;
        }

    }
    out.push_back(0);
	out.push_back(0);
	return out;
}