#include using namespace std; //Constants #define fori(x) for (unsigned int i = 0; i < x; i++) #define forj(x) for (unsigned int j = 0; j < x; j++) #define fork(x) for (unsigned int k = 0; k < x; k++) #define forin(x, u) for (unsigned int i = 0; i < x; i++) #define forde(x, u) for (unsigned int u = x - 1; u >= 0; u--) #define DBG(x) cout << (x) << endl; #define DBGT(x, t) cout << (t) << ": " << (x) << endl; #define DBGVECTOR(x, t) cout << t << ": "; for (unsigned int z = 0; z < x.size(); z++) cout << x[z] << " "; cout << endl; #define DBGARRAY(x, s, t) cout << t << ": "; for (unsigned int z = 0; z < s; z++) cout << x[z] << " "; cout << endl; #define GETVEC(x, s) for (unsigned int z = 0; z < s; z++) { cin >> temp; x.push_back(temp); } typedef long long ll; typedef pair pll; typedef pair pdd; typedef pair pii; const ll mod7 = 1000000007; //Structs //Global Variables ll A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z; ll temp, temp2; char tempChar; string tempString; //Function Declarations int main() { int minx = INT_MAX, maxx = INT_MIN, miny = INT_MAX, maxy = INT_MIN; cin >> N; bool acceptable = true; fori(N) { acceptable = true; cin >> B; forj(B) { cin >> temp >> temp2; if (j != 0) { if (!((temp == minx || temp == maxx) || (temp2 == miny || temp2 == maxy))) { //DBGT(temp, "Broke"); acceptable = false; } } if (temp <= minx) minx = temp; if (temp2 <= miny) miny = temp2; if (temp >= maxx) maxx = temp; if (temp2 >= maxy) maxy = temp2; } if (acceptable) cout << "YES" << endl; else cout << "NO" << endl; } }