#include #define endl '\n'; using namespace std; typedef long long int LL; vector >v; bool cmp(pair a, pair b) { if(a.firstb.first)return false; return a.second>b.second; } int main() { ios_base::sync_with_stdio(false);cin.tie(0); //freopen("input.in","r",stdin); int q;cin>>q;while(q--) { int n; cin>>n; v.clear(); vectora,b; for(int i=0;i>x>>y; v.push_back(make_pair(x,y)); a.push_back(x); b.push_back(y); } sort(a.begin(),a.end()); sort(b.begin(),b.end()); bool fnf=true; for(int i=0;i