#include<bits/stdc++.h>
int T,N,K,cnt,tot,x,ans1,ans2;
bool hv[23];
int main(){
scanf(" %d",&T);
while(T--){
scanf(" %d",&N);ans2=0;
while(N--){
scanf(" %d",&K);
memset(hv,false,sizeof(hv));cnt=20-K+1;tot=0;ans1=0;
while(K--){
scanf(" %d",&x);
hv[x]=true;
}
for(int i=1;i<=20;++i){
if(!hv[i]){
if((--cnt)&1)ans1^=tot;
tot=0;
}
else ++tot;
}
ans2^=ans1;
}
if(ans2)printf("YES\n");
else printf("NO\n");
}
return 0;
}