#include using namespace std; bool on_border(int x1, int y1, int x2, int y2, int x, int y){ if(x1 > x2) swap(x1,x2); if(y1 > y2) swap(y1,y2); if(x == x1 && y1 <= y && y <= y2) return true; if(x == x2 && y1 <= y && y <= y2) return true; if(y == y1 && x1 <= x && x <= x2) return true; if(y == y2 && x1 <= x && x <= x2) return true; return false; } string solve(){ int n; cin >> n; vector > arr(n); vector x,y; for(int i = 0; i < n; ++i){ cin >> arr[i].first >> arr[i].second; x.push_back(arr[i].first); y.push_back(arr[i].second); } for(int x1 : x) for(int x2 : x) for(int y1 : y) for(int y2 : y){ bool ok = true; for(auto t : arr) if(!on_border(x1,y1,x2,y2,t.first,t.second)) ok = false; if(ok) return "YES"; } return "NO"; } int main(){ int q; cin >> q; while(q--) cout << solve() << '\n'; }