#include "code.h"
#include <bits/stdc++.h>
using namespace std;

const int mx = 1e3+5;
int a[mx][mx];
int r[mx], kr[mx], c[mx], kc[mx];

std::vector<int> Nadji(int n, int K)
{
    fill(c, c+mx, 1e9+1);
	for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            a[i][j] = Pitaj(i, j);
            if (a[i][j] >= r[i]) {
                if (a[i][j] == r[i]) {
                    kr[i]++;
                }
                else {
                    r[i] = a[i][j];
                    kr[i] = 1;
                }
            }
            if (a[i][j] <= c[j]) {
                if (a[i][j] == c[j]) {
                    kc[j]++;
                }
                else {
                    c[j] = a[i][j];
                    kc[j] = 1;
                }
            }
        }
	}
	vector<int> ans(2, 0);
	for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (a[i][j] == r[i] && a[i][j] == c[j] && r[i] == 1 && c[j] == 1) {
                ans[0] = i; ans[1] = j;
            }
        }
	}
	return ans;
}