#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];
vector<pii> p, cist;
///PROMENITI RAND AKO RADIS VELIKO!!!!!!
std::vector<int> Nadji(int N, int K)
{
    srand(100286);
    int cnt = N*N;
    int K1 = K;
	// neka slucajna pitanja
	/*while(K1-- && cnt--) {
        int i, j;
        while(1) {
            i = rand()%N+1;
            j = rand()%N+1;
            if(!pitano[i][j]) break;
        }
        val[i][j] = Pitaj(i, j);
        pitano[i][j] = 1;
        p.pb({i, j});
	}*/
	for(int i = 1; i <= N; i++) {
        val[1][i] = Pitaj(1, i);
        p.pb({1, i});
        val[i][i] = Pitaj(i, i);
        p.pb({i, i});
        val[i][1] = Pitaj(i, 1);
        p.pb({i, 1});
        val[i][N-i+1] = Pitaj(i, N-i+1);
        p.pb({i, N-i+1});
	}
	for(int i = 0; i < sz(p); i++) {
        for(int j = 0; j < i; j++) {
            //PRINT("ULAZIII");
            if(val[p[i].fi][p[i].se] > val[p[j].fi][p[j].se]) {
                elim[p[i].fi][p[j].se] = 1;
                /*PRINT(1);
                PRINT(p[i].fi);
                PRINT(p[i].se);
                PRINT(p[j].fi);
                PRINT(p[j].se);*/
            } else {
                elim[p[j].fi][p[i].se] = 1;
                /*PRINT(2);
                PRINT(p[i].fi);
                PRINT(p[i].se);
                PRINT(p[j].fi);
                PRINT(p[j].se);*/
            }
        }
	}
	for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= N; j++) {
            if(!elim[i][j]) {
                cist.pb({i, j});
                //PRINT(i);
                //PRINT(j);
            }
        }
	}
	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;
	}
}