#include using namespace std; using ll = long long; template using vec = vector; template using vvec = vector>; int main(){ cin.tie(0); ios::sync_with_stdio(false); int M = 500; vvec id(M,vec(M,-1)); vvec ok(M,vec(M,1)); int N; cin >> N; for(int i=0;i> x >> y; x--; y--; id[x][y] = i; } vec ans; auto in = [&](int x,int y){ return 0<=x && x