#include using namespace std; #define endl '\n' #define ff first #define ss second #define pb push_back #define mp make_pair typedef long long llong; typedef pair pii; void process(){ int n; cin >> n; list l; int min_y = 1e5, max_y = -1e5; int min_x = 1e5, max_x = -1e5; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; l.pb( mp(x, y) ); min_y = min(min_y, y); max_y = max(max_y, y); min_x = min(min_x, x); max_x = max(max_x, x); } for (auto it = l.begin(); it != l.end();) { if (it -> ss == min_y || it -> ss == max_y || it -> ff == min_x || it -> ff == max_x) { it = l.erase(it); } else it++; } cout << (l.empty() ? "YES\n" : "NO\n"); } void solve() { int n; cin >> n; for (int i = 0; i < n; i++) process(); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifdef LOCAL ifstream in("in"); cin.rdbuf(in.rdbuf()); #endif solve(); return 0; }