#include #include using namespace std; int main() { int t; cin >> t; while (t--) { bool check = false; int Array[10000][10000]; int xsmall = 0; int ysmall = 0; int xbig = 0; int ybig = 0; int quer; cin >> quer; for (int i = 0; i < quer; i++) { int x,y; cin >> x >> y; Array[x][y]++; if(x < xsmall) xsmall = x; else if(x > xbig) xbig = x; if(y < ysmall) xsmall = x; else if(y > ybig) ybig = y; } for(int i = 0; i < xbig; i++){ for(int j = 0; j < ybig;j++){ if(Array[i][j] != 0) check = false; } } if(check == true) cout << "YES\n"; else cout << "NO\n"; } }