#include<bits/stdc++.h> #define bit(t) (1 << t) using namespace std; const int maxn = 1<<21; const int k = 22;//k是集合s的大小 int sg[maxn];//sg[n] n表示每堆数量 bool vis[22]; void get_sg(){ int maxm = 1<<20; for(int sta = 0; sta < maxm; sta ++){ // printf("**%d** ",sta); memset(vis, 0, sizeof(vis)); for(int i = 19; i >= 0; i --){ if(sta & bit(i)) for(int j = i - 1; j >= 0; j --){ if(sta & bit(j))continue; int tmp = sta; tmp |= bit(j); tmp &= (~bit(i)); vis[sg[tmp]] = true; break; } } for(int i = 0; i < 20; i ++) if(!vis[i]){ sg[sta] = i;break; } } } int main() { get_sg(); int T,n,m,a,sta;scanf("%d",&T); while(T --){ int goal = 0; scanf("%d",&n); while(n --){ scanf("%d",&m); sta = 0; while(m--){ scanf("%d",&a); sta |= (1 << (20 - a)); } goal ^= sg[sta]; } printf("%s ",goal?"YES":"NO"); } }