#include #include #include #include #include using namespace std; int main() { int T; cin>>T; for (auto t = 0; t>n; vector xcords(n), ycords(n); vector > pairs(n); for (auto i = 0; i>x>>y; pairs[i] = pair(x,y); xcords[i] = x; ycords[i] = y; } int x1 = *min_element(xcords.begin(), xcords.end()); int x2 = *max_element(xcords.begin(), xcords.end()); int y1 = *min_element(ycords.begin(), ycords.end()); int y2 = *max_element(ycords.begin(), ycords.end()); bool flag = true; for (auto ii: pairs) { auto v1 = ii.first; auto v2 = ii.second; if (!(((v1==x1 || v1==x2) /*&& (v2>=y1 && v2<=y2)*/) || ((v2==y1 || v2==y2) /*&& (v1>=x1 && v1<=x1)*/))) { cout<<"NO"<