#include "code.h"
#include <bits/stdc++.h>
#define MAXN 3010
using namespace std;
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define sz(x) int((x).size())
#define PRINT(x) cerr<<#x<<'='<<x<<endl;
bool pitano[MAXN][MAXN], elim[MAXN][MAXN];
int val[MAXN][MAXN];
///PROMENITI RAND AKO RADIS VELIKO!!!!!!
int upit(int i, int j) {
    //PRINT(i);
    //PRINT(j);
    if(val[i][j] != 0) return val[i][j];
    return val[i][j] = Pitaj(i, j);
}
std::vector<int> Nadji(int N, int K)
{
    for(int i = 0; i <= N; i++) val[i][0] = -1;
    //srand(100286);
    //if(K == N*N) {
        for(int i = 1; i <= N; i++) {
            int maxJ = 0, cnt = 1;
            for(int j = 1; j <= N; j++) {
                if(upit(i, j) > upit(i, maxJ)) maxJ = j, cnt = 1;
                else if(upit(i, j) == upit(i, maxJ)) cnt++;
            }
            if(cnt > 1) continue;
            bool valid = 1;
            for(int j = 1; j <= N; j++) {
                if(i != j && upit(j, maxJ) <= upit(i, maxJ)) {
                    valid = 0; break;
                }
            }
            if(valid) {
                vector<int> q = {i, maxJ};
                return q;
            }
        }
        vector<int> q = {0, 0};
        return q;
    /*int cnt = N*N;
    int K1 = K;
	for(int i = 1; i <= N; i++) {
        for(int j = (i%2==0)?2:1; j <= N; j+=2) {
            val[i][j] = Pitaj(i, j);
            p.pb({i, j});
        }
	}
	for(int i = 0; i < sz(p); i++) {
        for(int j = 0; j < i; j++) {
            if(val[p[i].fi][p[i].se] > val[p[j].fi][p[j].se]) {
                elim[p[i].fi][p[j].se] = 1;
            } else {
                elim[p[j].fi][p[i].se] = 1;
            }
        }
	}
	for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= N; j++) {
            if(!elim[i][j]) {
                std::vector<int> out = {i, j};
                PRINT(i);
                PRINT(j);
                //return out;
            }
        }
	}
	//if(cist.size() == 0) {
        std::vector<int> out = {0,0};
        return out;
	/*} else {
        int x = rand()%cist.size();
        // primer kada hocemo da vratimo (2, 3)
        std::vector<int> out;
        out.push_back(cist[x].fi);
        out.push_back(cist[x].se);
        return out;
	}*/

}