#include <bits/stdc++.h>
using namespace std;
int q[10003];
int con[10003];
int N;
void initialize(int n){
N=n-1;
}
/*
The key idea is simple: Build a tree and that's it. Find a way to build a tree so that, up until the penultimate query, is not yet a tree.
Could be done in many ways: the DSU that only connects the final edges between 2 components, the kind of thing mentioned in the editorial, or.......find a way to seperate all kinds of edges into N-1 non-intersecting sets, then answering YES to the final edge that belongs to each individual set.
Instead of following the big-brain thing of the editorial........
*/
int hasEdge(int u, int v){
q[abs(u-v)]++;
return (q[abs(u-v)]==N-abs(u-v));
}