#include using namespace std; typedef long long LL; #define F(N,S,T) for(int N=(S);N<=(T);N++) const int N=1001001; int x[N],y[N]; typedef pair P; void work(){ int n; cin>>n; F(i,1,n)cin>>x[i]>>y[i]; set

s; F(i,1,n)s.insert(P(x[i],y[i])); int ans=0; F(i,1,n)ans=max(ans,(x[i]==2&&s.count(P(1,y[i]+1))?1:0)+x[i]+y[i]); cout<>t; while(t--){ work(); } return 0; }