#include<bits/stdc++.h>
using namespace std;
inline int read()
{
register int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=(x<<3)+(x<<1)+(c^48);
c=getchar();
}
return x*f;
}
const int dx[4]={1,-1,0,0};
const int dy[4]={0,0,1,-1};
const int maxn=1005;
bool f[maxn][maxn],vis[maxn][maxn];
int main()
{
int t=read();
while(t--)
{
bool flag=0;
queue<pair<int,int> > q;
int n=read(),top=0;
q.push(make_pair(1,1));
vis[1][1]=1;
while(!q.empty())
{
top++;
if(top<=2*n-2)
{
int le=read(),ri=read();
f[le][ri]=1;
}
if(q.front().first==n && q.front().second==n)
{
flag=1;
break;
}
for(int i=0;i<4;i++)
{
int xx=q.front().first+dx[i],yy=q.front().second+dy[i];
if(xx<1 || xx>n || yy<1 || yy>n || f[xx][yy]==1 || vis[xx][yy]==1) continue;
q.push(make_pair(xx,yy));
vis[xx][yy]=1;
}
}
if(flag) cout<<"Yes\n";
else cout<<"No\n";
getchar();
}
return 0;
}