/*
 * Bidhan Roy
 * University of Dhaka
 */

using namespace std;
#include <bits/stdc++.h>

#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)
#define sgn(x,y) ((x)+eps<(y)?-1:((x)>eps+(y)?1:0))
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define mem(x,val) memset((x),(val),sizeof(x));
#define rite(x) freopen(x,"w",stdout);
#define read(x) freopen(x,"r",stdin);
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define pb push_back
#define mp make_pair
#define clr clear()
#define inf (1<<30)
#define ins insert
#define xx first
#define yy second
#define eps 1e-9

typedef long long i64;
typedef unsigned long long ui64;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
typedef map<int,int> mii;
typedef map<st,int> msi;
typedef set<int> si;
typedef set<st> ss;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define mx 0

struct data{
    char F,L;
    i64 oc;
    void print(){
        cout<<F<<" "<<oc<<" "<<L<<endl;
    }
};

data get( st &inp ,int ttt){
    data ret;
    ret.oc=0;
    ret.F=inp[0];
    ret.L=inp[ sz(inp)-1 ];
    ret.oc=ttt;
    //rep(i,sz(inp)) ret.oc+= (inp.substr(i,2)=="AC");
    return ret;
}

data add( data a, data b){
    //cout<<"in add "<<endl;
    //a.print();
    //b.print();
    data ret;
    ret.oc=a.oc+b.oc;
    ret.F=a.F;
    ret.L=b.L;
    if(a.L=='A' && b.F=='C') ret.oc++;
    return ret;
}

int k,x,n,m;

bool call( st &a, st &b ,int ooo,int xxx){
    //cout<<a<<" test "<<b<<endl;
    vector<data> s;
    s.pb(get(a,ooo));
    s.pb(get(b,xxx));
    for(int i=2; i<k; i++){
        s.pb(add(s[i-2],s[i-1]));
        if(s.back().oc>x) return false;
    }
    //s[0].print();
    //s[1].print();
    //s[2].print();

    if(s.back().oc==x){
        rep(i,sz(a)) if(a[i]==' ') a[i]='X';
        rep(i,sz(b)) if(b[i]==' ') b[i]='X';
        cout<<a<<endl<<b<<endl;
        return true;
    }
    return false;
}

st form(st &inp,int oc){
    st ret=inp;
    if(!oc) return ret;
    if(inp[0]=='X' && inp[sz(inp)-1]=='X'){
        for(int i=1; i<sz(inp)-1; i+=2) {
            if(!oc) break;
            ret[i]='A', ret[i+1]='C', oc--;
        }
        return ret;
    }
    st my="AC";
    if(inp[0]=='A'){
        //cout<<"here"<<endl;
        for(int i=1, idx=1; i<sz(inp)-1; i++, idx=!idx) {
            if(!oc) break;
            ret[i]=my[idx];
            if(my[idx]=='C') oc--;
        }
        return ret;
    }
    if(inp[sz(inp)-1]=='C'){
        for(int i=sz(inp)-2, idx=0; i>0; i--, idx=!idx) {
            if(!oc) break;
            ret[i]=my[idx];
            if(my[idx]=='A') oc--;
        }
        return ret;
    }
    for(int i=1; i<sz(inp)-1; i+=2) {
        if(!oc) break;
        ret[i]='A', ret[i+1]='C', oc--;
    }
    return ret;
}

int cc(st &inp){
    int ret=0;
    rep(i,sz(inp)-1){
        ret+=( inp[i]=='A' && inp[i+1]=='C');
    }
    return ret;
}

void solve(){
                    st a,b;
                rep(i,n) a+=' ';
                rep(j,m) b+=' ';
            st my="ACX";
        rep(sa,3) rep(ea,3) {
            rep(sb,3) rep(eb,3) {

                a[0]=my[sa], a[n-1]=my[ea];
                b[0]=my[sb], b[m-1]=my[eb];
                for(int ocA=0; ocA<=(n>>1); ocA++){
                    for(int ocB=0; ocB<=(m>>1); ocB++){
                        st tA=form(a,ocA);
                        st tB=form(b,ocB);
                        int aaa=cc(tA);
                        int bbb=cc(tB);
                        if(aaa!=ocA) continue;
                        if(bbb!=ocB) continue;
                        if(call(tA,tB,aaa,bbb)) return ;
                    }
                }
            }
        }
        cout<<"Happy new year!"<<endl;

}

int main(){
    //st test;
    //int oc;
    //while(cin>>test>>oc) cout<<form(test,oc)<<endl;
    ios_base::sync_with_stdio(0);
    while(1){
        k=50;
        x=1000000000;
        n=100;
        m=100;
        solve();
        break;
    }
    return 0;
}


/* ********************************************
*    *     *      *    * * * *     * * * *    *
*   * *   * *   ***    *     *    *       *   *
*   *  * *  *  ****    * * *      *       *   *
*   *   *   *     *    * *        *       *   *
*   *       *     *    *  *       *       *   *
*   *       *     *    *   *      *       *   *
*   *       *     *    *    *      * * * *    *
********************************************* */
#include <fstream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <string>
#include <cassert>

#define MP make_pair
#define FOR(v,p,k) for(int v=p;v<=k;++v)
#define FORD(v,p,k) for(int v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(__typeof(c.begin()) i=(c.begin());i!=(c).end();++i)
#define PB push_back
#define FI first
#define SE second
#define ABS(x)(x < 0)?(-x):(x)
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define MAX(a,b)(a > b)?(a):(b)
#define MIN(a,b)(a > b)?(b):(a)
#define ZERO(x) memset(x,0,sizeof(x))
#define PI acos(-1)
#define eps 1e-13
#define MOD 1000000007
#define NMAX 1000000
#define INF -1

using namespace std;
typedef long long LL;

LL l , r1 , n , k , e , r , a[10000] , ans , aq[200][200] , x , i ,j;

int main(){
  cin >> n;
  FOR(i,1,n){
    cin >> r1;
    FOR(j,1,r1){
      cin >> x;
      aq[i][x] = 1;
    }
  }
  FOR(i,1,n){
     FOR(j,1,n)
       if(i != j){
         FOR(l,1,100)
           if(aq[i][l] == 0 && aq[j][l] == 1) break;
           if(l == 101) break;
       }
       if(j <= n) cout << "NO" << endl;
          else cout << "YES" << endl;
  }
  return 0;
}


/* ********************************************
*    *     *      *    * * * *     * * * *    *
*   * *   * *   ***    *     *    *       *   *
*   *  * *  *  ****    * * *      *       *   *
*   *   *   *     *    * *        *       *   *
*   *       *     *    *  *       *       *   *
*   *       *     *    *   *      *       *   *
*   *       *     *    *    *      * * * *    *
********************************************* */
#include <fstream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <string>
#include <cassert>

#define MP make_pair
#define FOR(v,p,k) for(v=p;v<=k;++v)
#define FORD(v,p,k) for(v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(__typeof(c.begin()) i=(c.begin());i!=(c).end();++i)
#define PB push_back
#define FI first
#define SE second
#define ABS(x)(x < 0)?(-x):(x)
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define MAX(a,b)(a > b)?(a):(b)
#define MIN(a,b)(a > b)?(b):(a)
#define ZERO(x) memset(x,0,sizeof(x))
#define PI acos(-1)
#define eps 1e-13
#define MOD 1000000007
#define NMAX 1000000
#define INF -1

using namespace std;
typedef long long LL;

LL l , r1 , n , k , e , r , a[10000] , ans , aq[200][200] , x , i ,j;

main(){
  cin >> n;
  for(i = 1 ; i <= n ; i++){
    cin >> r1;
    FOR(j,1,r1){
      cin >> x;
      aq[i][x] = 1;
    }
  }
  for(i = 1 ; i <= n ; i++){
     for(j = 1 ; j <= n ; j++)
       if(i != j){
         for(l  = 1 ; l <= 100 ; i++)
           if(aq[i][l] == 0 && aq[j][l] == 1) break;
           if(l == 101) break;
       }
       if(j <= n) cout << "NO" << endl;
          else cout << "YES" << endl;
  }
  return 0;
}


/* ********************************************
*    *     *      *    * * * *     * * * *    *
*   * *   * *   ***    *     *    *       *   *
*   *  * *  *  ****    * * *      *       *   *
*   *   *   *     *    * *        *       *   *
*   *       *     *    *  *       *       *   *
*   *       *     *    *   *      *       *   *
*   *       *     *    *    *      * * * *    *
********************************************* */
#include <fstream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <string>
#include <cassert>

#define MP make_pair
#define FOR(v,p,k) for(v=p;v<=k;++v)
#define FORD(v,p,k) for(v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(__typeof(c.begin()) i=(c.begin());i!=(c).end();++i)
#define PB push_back
#define FI first
#define SE second
#define ABS(x)(x < 0)?(-x):(x)
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define MAX(a,b)(a > b)?(a):(b)
#define MIN(a,b)(a > b)?(b):(a)
#define ZERO(x) memset(x,0,sizeof(x))
#define PI acos(-1)
#define eps 1e-13
#define MOD 1000000007
#define NMAX 1000000
#define INF -1

using namespace std;
typedef long long LL;

LL l , r1 , n , k , e , r , a[10000] , ans , aq[200][200] , x , i ,j;

main(){
  cin >> n;
  FOR(i,1,n){
    cin >> r1;
    FOR(j,1,r1){
      cin >> x;
      aq[i][x] = 1;
    }
  }
  FOR(i,1,n){
     FOR(j,1,n)
       if(i != j){
         FOR(l,1,1000)
           if(aq[i][l] == 0 && aq[j][l] == 1) break;
           if(l == 101) break;
       }
       if(j <= n) cout << "NO" << endl;
          else cout << "YES" << endl;
  }
  return 0;
}


/* ********************************************
*    *     *      *    * * * *     * * * *    *
*   * *   * *   ***    *     *    *       *   *
*   *  * *  *  ****    * * *      *       *   *
*   *   *   *     *    * *        *       *   *
*   *       *     *    *  *       *       *   *
*   *       *     *    *   *      *       *   *
*   *       *     *    *    *      * * * *    *
********************************************* */
#include <fstream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <string>
#include <cassert>

#define MP make_pair
#define FOR(v,p,k) for(v=p;v<=k;++v)
#define FORD(v,p,k) for(v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(__typeof(c.begin()) i=(c.begin());i!=(c).end();++i)
#define PB push_back
#define FI first
#define SE second
#define ABS(x)(x < 0)?(-x):(x)
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define MAX(a,b)(a > b)?(a):(b)
#define MIN(a,b)(a > b)?(b):(a)
#define ZERO(x) memset(x,0,sizeof(x))
#define PI acos(-1)
#define eps 1e-13
#define MOD 1000000007
#define NMAX 1000000
#define INF -1

using namespace std;
typedef long long LL;

LL l , r1 , n , k , e , r , a[10000] , ans , aq[200][200] , x , i ,j;

int main(){
  cin >> n;
  FOR(i,1,n){
    cin >> r1;
    FOR(j,1,r1){
      cin >> x;
      aq[i][x] = 1;
    }
  }
  FOR(i,1,n){
     FOR(j,1,n)
       if(i != j){
         FOR(l,1,1000)
           if(aq[i][l] == 0 && aq[j][l] == 1) break;
           if(l == 101) break;
       }
       if(j <= n) cout << "NO" << endl;
          else cout << "YES" << endl;
  }
  return 0;
}


/* ********************************************
*    *     *      *    * * * *     * * * *    *
*   * *   * *   ***    *     *    *       *   *
*   *  * *  *  ****    * * *      *       *   *
*   *   *   *     *    * *        *       *   *
*   *       *     *    *  *       *       *   *
*   *       *     *    *   *      *       *   *
*   *       *     *    *    *      * * * *    *
********************************************* */
#include <fstream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <string>
#include <cassert>

#define MP make_pair
#define FOR(v,p,k) for(v=p;v<=k;++v)
#define FORD(v,p,k) for(v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(__typeof(c.begin()) i=(c.begin());i!=(c).end();++i)
#define PB push_back
#define FI first
#define SE second
#define ABS(x)(x < 0)?(-x):(x)
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define MAX(a,b)(a > b)?(a):(b)
#define MIN(a,b)(a > b)?(b):(a)
#define ZERO(x) memset(x,0,sizeof(x))
#define PI acos(-1)
#define eps 1e-13
#define MOD 1000000007
#define NMAX 1000000
#define INF -1

using namespace std;
typedef long long LL;

LL l , r1 , n , k , e , r , a[10000] , ans , aq[200][200] , x , i ,j;

main(){
  cin >> n;
  for(i = 1 ; i <= n ; i++){
    cin >> r1;
    FOR(j,1,r1){
      cin >> x;
      aq[i][x] = 1;
    }
  }
  for(i = 1 ; i <= n ; i++){
     for(j = 1 ; j <= n ; j++)
       if(i != j){
         for(l  = 1 ; l <= 100 ; l++)
           if(aq[i][l] == 0 && aq[j][l] == 1) break;
           if(l == 101) break;
       }
       if(j <= n) cout << "NO" << endl;
          else cout << "YES" << endl;
  }
  return 0;
}


/* ********************************************
*    *     *      *    * * * *     * * * *    *
*   * *   * *   ***    *     *    *       *   *
*   *  * *  *  ****    * * *      *       *   *
*   *   *   *     *    * *        *       *   *
*   *       *     *    *  *       *       *   *
*   *       *     *    *   *      *       *   *
*   *       *     *    *    *      * * * *    *
********************************************* */
#include <fstream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <string>
#include <cassert>

#define MP make_pair
#define FOR(v,p,k) for(int v=p;v<=k;++v)
#define FORD(v,p,k) for(int v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(__typeof(c.begin()) i=(c.begin());i!=(c).end();++i)
#define PB push_back
#define FI first
#define SE second
#define ABS(x)(x < 0)?(-x):(x)
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define MAX(a,b)(a > b)?(a):(b)
#define MIN(a,b)(a > b)?(b):(a)
#define ZERO(x) memset(x,0,sizeof(x))
#define PI acos(-1)
#define eps 1e-13
#define MOD 1000000007
#define NMAX 1000000
#define INF -1

using namespace std;
typedef long long LL;

LL l , r1 , n , k , e , r , a[10000] , ans , aq[200][200] , x , i ,j;

int main(){
  cin >> n;
  FOR(i,1,n){
    cin >> r1;
    FOR(j,1,r1){
      cin >> x;
      aq[i][x] = 1;
    }
  }
  FOR(i,1,n){
     FOR(j,1,n)
       if(i != j){
         FOR(l,1,1000)
           if(aq[i][l] == 0 && aq[j][l] == 1) break;
           if(l == 101) break;
       }
       if(j <= n) cout << "NO" << endl;
          else cout << "YES" << endl;
  }
  return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
    int n;
    int a[105][105];
    int i,j,k;
    int m;
    int ce;
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d",&m);
        for(j=0; j<m; j++)
        {
            scanf("%d",&ce);
            a[i][ce]=1;
        }
    }
    if (n==1)
    {
        printf("YES\n");
        return 0;
    }
    int cnt;
    for(i=0; i<n; i++)
    {
        for(j=0; j<m; j++)
        {
            cnt=0;
            if (i==j)
                continue;
            for(k=1; k<=100; k++)
                if (a[i][k]==0&&a[j][k])
                    cnt=1;
        }
        if (cnt)
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <stdio.h>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <set>

using namespace std;

int num[105][105],vec[105];
int main()
{
    int i,j,a,n,m,k,p,t,flag=0;
    scanf("%d",&n);
    for(i=0;i<105;i++)
        vec[i]=2;
    for(i=0;i<n;i++){
        scanf("%d",&m);
        p=0;
        while(m--){
            scanf("%d",&a);
            num[i][p]=a;
            p++;
        }
    }
    for(i=0;i<n;i++){
        for(k=0;k<n;k++){
            if(k==i)
                continue;
            for(j=0;j<101&&num[i][j]!=0;j++){
                flag=0;
                for(t=0;t<101&&num[k][t]!=0;t++)
                {
                    if(num[i][j]==num[k][t])
                    {
                        flag=1;
                        break;
                    }
                }
                if(flag==0)
                    break;
            }
            if(num[i][j]==0){
                if(vec[i]!=0)
                    vec[i]=1;
                vec[k]=0;
            }
            else {
                if(vec[k]!=0)
                    vec[k]=1;
                if(vec[i]!=0)
                    vec[i]=1;
            }
        }
    }
    for(i=0;i<n;i++)
    {
        if(vec[i]!=0)
            printf("YES\n");
        else printf("NO\n");
    }
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <bitset>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <list>
#include <map>
#include <set>
using namespace std;
/***************************************/
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<string> VS;
typedef set<int> SI;
typedef set<string> SS;
typedef map<int ,int> MII;
typedef map<string,int> MSI;
typedef pair<int,int> PII;
typedef vector<PII> VII;
typedef vector<VI > VVI;
/***************************************/
#define clr(a,b) memset(a,b,sizeof(a))
#define ll long long
#define int64 __int64
#define LL(x) ((x)<<1)
#define RR(x) ((x)<<1|1)
#define MP(a,b) make_pair(a,b)
#define RI(x) scanf("%d",&x)
#define RII(x,y) scanf("%d%d",&x,&y)
#define RD(x) scanf("%lf",&x)
#define RDD(x,y) scanf("%lf%lf",&x,&y)
#define RS(x) scanf("%s",x)
#define PI(x) printf("%d",x)
#define PS(x) printf("%s",x)
#define PN()  printf("\n")
#define REP(i,a,b)  for(int i=(a);i<(b);i++)
#define REPU(i,a,b) for(int i=(a);i<=(b);i++)
#define REPD(i,a,b) for(int i=(a);i>=(b);i--)
#define REPC(i,a,c) for(int i=(a);(c);i++)
/***************************************/
const int INF = 0x7f7f7f7f;
const double eps = 1e-8;
const double PIE=acos(-1.0);
const int dx[]= {0,-1,0,1};
const int dy[]= {1,0,-1,0};
const int fx[]= {-1,-1,-1,0,0,1,1,1};
const int fy[]= {-1,0,1,-1,1,-1,0,1};
/***************************************/
void openfile()
{
	freopen("data.in","rb",stdin);
	freopen("data.out","wb",stdout);
}
/***************************************/

int a[110][110];
int main()
{
	int n,m,x;
	RI(n);
	clr(a,0);
	REP(i,0,n)
	{
		RI(m);
		REP(j,0,m)
		{
			RI(x);
			a[i][x]=1;
		}
	}
	int flag;
	REP(i,0,n)
	{
		REP(j,0,n)
		{
			if(i==j)	continue;
			flag=0;
			REPU(k,1,100)
				if(a[j][k]&&!a[i][k])
				{
					flag=1;
					break;
				}
			if(flag==0)
				break;
		}
		if(flag)
			puts("YES");
		else
			puts("NO");
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define MM 200

int n, tot[MM], a[MM][MM];

int main()

{

//	freopen ("in.txt", "r", stdin);

	scanf ("%d", &n);

	for (int i=0; i<n; i++){

		scanf ("%d", tot+i);

		for (int j=0; j<tot[i]; j++) scanf("%d", a[i]+j);

		sort(a[i], a[i]+tot[i]);

	}

	int ok;

	for (int i=0; i<n; i++){

		ok=0;

		for (int j=0; j<n; j++){

			if (i==j || tot[i]<tot[j]) continue;

			int k;

			for (k=0; k<tot[j]; k++) if(a[i][k]!=a[j][k]) break;

			if(k>=tot[j]) {ok=1; break;}

		}

		if(ok) puts("NO");

		else puts("YES");

	}

	return 0;

}


#include <bits/stdc++.h>

using namespace std;

set<int> s[200];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n;

	scanf("%d",&n);

	for(int i=0;i<n;i++){

		int x;

		scanf("%d",&x);

		while(x--){

			int xx;

			scanf("%d",&xx);

			s[i].insert(xx);

		}

	}

	int flag=1;

	for(int i=0;i<n;i++){

		flag=1;

		for(int j=0;j<n;j++){

			if(i==j) continue ;

			flag=0;

			for(int ii=1;ii<=100;ii++){

				if(s[i].count(ii)==0 and s[j].count(ii)==1) flag=1;

			}

			if(flag==0) {printf("NO\n");break;}

		}

		if(flag) printf("YES\n");

	}

	return 0;

}


#include <bits/stdc++.h>

using namespace std;

int m[110],a[110][110],b[110][110];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

		int n;

		scanf("%d",&n);

		for(int i=1;i<=n;i++){

			scanf("%d",&m[i]);

			for(int j=1;j<=m[i];j++) scanf("%d",&a[i][j]);

		}

		for(int i=1;i<=n;i++){

			for(int j=1;j<=m[i];j++) b[i][a[i][j]]++;

		}

		for(int i=1;i<=n;i++){

			int flag=0;

			for(int j=1;j<=n;j++){

				if(j==i) continue;

				int num=0;

				for(int k=1;k<=m[j];k++){

					if(b[i][a[j][k]]!=0) num++;

				}

					if(num==m[j]) flag=1;

			}

				if(flag==1) printf("%s\n","NO");

				else printf("%s\n","YES");

		}

			return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define mod 1000000007

#define hmod 911382323

#define pb push_back

#define sq(x) ((x)*(x))

#define sz(a) ((int)a.size())

#define LEN(a) (a.length())

#define x first

#define y second

#define ls (u<<1)

#define rs (ls + 1)

#define mid (st + ed >> 1)

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define rands(n) (rand()%n+1)

#define rand0(n) (rands(n)-1)

#define Rands(n) ((INT)rand()*rand()%n+1)

#define Rand0(n) (Rands(n)-1)

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

#define rep(i, a, b) for(int i=a; i<b; i++)

#define eprintf(...) fprintf(stderr, __VA_ARGS__)

#define shit(a) (1 << (a))

#define all(a) ((a).begin(), (a).end())

#define rev(a) (power(a, mod-2, mod))

using namespace std;

typedef long long INT;

typedef unsigned long long UINT;

typedef unsigned int uint;

typedef complex<double> Complex;

typedef double DO;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<INT, INT> PII;

typedef pair<pii, int> ppi;

typedef pair<int, pii> pip;

typedef pair<DO, DO> pdd;

typedef pair<int, DO> pid;

typedef pair<DO, int> pdi;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN  111

int a[NN][NN];

int n;

int vst[NN];

int m[NN];

int win(int u) {

	memset(vst, 0, sizeof vst);

	for(int i=0; i<m[u]; i++) vst[a[u][i]]=1;

	for(int i=1; i<=n; i++) if(i!=u) {

		int cnt=0, oth=0;

		for(int j=0; j<m[i]; j++) {

			if(vst[a[i][j]]) cnt++;

			else oth++;

		}

		if(cnt<=m[i] and oth==0) return 0;

	}

	return 1;

}

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	cin >> n;

	for(int i=1; i<=n; i++) {

		gn(m[i]);

		for(int j=0; j<m[i]; j++) gn(a[i][j]);

	}

	for(int i=1; i<=n; i++) {

		if(win(i)) puts("YES");

		else puts("NO");

	}

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<typename T> inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template<typename T> inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<typename T> inline void println(T x) {print(x), putchar('\n');}

template<typename T> inline void printsp(T x) {print(x), putchar(' ');}

template<class T, class T1> inline void print(T x, T1 y) {printsp(x), println(y);}

template<class T, class T1, class T2> inline void print(T x, T1 y, T2 z) {printsp(x), printsp(y), println(z);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 110

int len[NN];

int a[NN][NN];

set<int> s[NN];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

    int n;

    gn(n);

    for(int i=1; i<=n; i++) {

        gn(len[i]);

        for(int j=1; j<=len[i]; j++) {

            gn(a[i][j]);

            s[i].insert(a[i][j]);

        }

    }

    for(int i=1; i<=n; i++) {

        int flag=1;

        for(int k=1; k<=n; k++) if(i!=k) {

            int num=0;

            for(int j=1; j<=len[i]; j++) if(s[k].count(a[i][j])) {

                num++;

            }

            if(s[k].size()==num) {

                flag=0;

                break;

            }

        }

        if(flag) puts("YES");

        else puts("NO");

    }

}


#include<bits/stdc++.h>

using namespace std;

set<int> s[200];

int m[200],cnt,flag;

int main() {

#ifndef ONLINE_JUDGE

    freopen("in.in", "r", stdin);

//    freopen("out.out", "w", stdout);

#endif

	int n,a;

	scanf("%d",&n);

	for(int i=1; i<=n; i++){

		scanf("%d",&m[i]);

		for(int j=0; j<m[i]; j++) {

			scanf("%d",&a);

			s[i].insert(a);

		}

	}

	for(int i=1; i<=n; i++){

		flag=1;

		for(int j=1; j<=n; j++) {

			if(j==i) continue;

			cnt=0;

			for(int k=1; k<=100; k++) if(s[i].count(k)>=s[j].count(k)) cnt++;

			if(cnt==100) {flag=0;break;}

		}

		if(flag) printf("YES\n");

		else printf("NO\n");

	}

}


#include <bits/stdc++.h>

using namespace std;

#define MM 200

int n, tot[MM], a[MM][MM], cnt[MM][MM];

int main()

{

//	freopen ("in.txt", "r", stdin);

	scanf ("%d", &n);

	for (int i=0; i<n; i++){

		scanf ("%d", tot+i);

		for (int j=0; j<tot[i]; j++) scanf("%d", a[i]+j), cnt[i][a[i][j]]=1;

	}

	int ok;

	for (int i=0; i<n; i++){

		ok=0;

		for (int j=0; j<n; j++){

			int m=0;

			if (i==j) continue;

			for (int k=0; k<tot[i]; k++){

				if(cnt[j][a[i][k]]) m++;

			}

			if (m==tot[j]) {ok=1; break;}

		}

		if(ok) puts("NO");

		else puts("YES");

	}

	return 0;

}


#include <bits/stdc++.h>

using namespace std;

#define MM 200

int n, tot[MM], a[MM][MM], ans[MM];

int main()

{

//	freopen ("in.txt", "r", stdin);

	scanf ("%d", &n);

	for (int i=0; i<n; i++){

		scanf ("%d", tot+i);

		for (int j=0; j<tot[i]; j++) scanf("%d", a[i]+j);

		sort(a[i], a[i]+tot[i]);

	}

	int ok=0, f=0;

	for (int i=0; i<n && ok!=2; i++){

		ok=0; f=0;

		for (int j=0; j<n; j++){

			if (i==j) continue;

			if(tot[i]<tot[j]) continue;

			int k;

			for (k=0; k<tot[j]; k++) if(a[i][k]!=a[j][k]) break;

			if(k>=tot[j]) {ok=1; break;}

		}

		if(ok) ans[i]=1;

	}

	for (int i=0; i<n; i++){

		if(ans[i]) puts("NO");

		else puts("YES");

	}

	return 0;

}


#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
using namespace std;
int check(int a[],int b[],int n,int m){
int c=0;
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
if(b[i]==a[j]){c++;break;}
}
}
if(c>=m)return 1;
else return c;
}
int main(){
int n,m[1000],a[500][500],i,j,l;
cin>>n;
for(i=1;i<=n;i++){
cin>>m[i];
for(j=1;j<=m[i];j++){
cin>>a[i][j];
}
}
for(i=1;i<=n;i++){
int v=0;
for(j=1;j<=n;j++){
if(j==i)continue;
if(m[i]<m[j])continue;
if(check(a[i],a[j],m[i],m[j])==1){v++;break;}
}
if(v==1)cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
using namespace std;
void qsort(int a[], int l, int r) {
   int i=l,j=r;
   int t;
   int m=a[(l+r)/2];
   while(i<=j){
   while(a[i]<m){
   i++;
   }
   while(a[j]>m){
   j--;
   }
   if(i<=j){
   swap(a[i],a[j]);
   i++;
   j--;
   }
   }
   if (l<j)qsort(a,l,j);
   if (i<r)qsort(a,i,r);
   }
int check(int a[],int b[],int n,int m){
int c=0;
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
if(a[j]==b[i]){c++;break;}
}
}
if(c>=m)return 1;
else return c;
}
int main(){
int n,m[1000],a[500][500],i,j,l;
cin>>n;
for(i=1;i<=n;i++){
cin>>m[i];
for(j=1;j<=m[i];j++){
cin>>a[i][j];
}
qsort(a[i],1,m[i]);
}
for(i=1;i<=n;i++){
int v=0;
for(j=1;j<=n;j++){
if(j==i)continue;
if(m[i]<m[j])continue;
if(check(a[i],a[j],m[i],m[j])==1){v++;break;}
}
if(v==1)cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
using namespace std;
int check(int a[],int b[],int n,int m){
int c=0;
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
if(b[i]==a[j]){c++;break;}
}
}
if(c>=m)return 1;
else return 2;
}
int main(){
int n,m[1000],a[500][500],i,j,l;
cin>>n;
for(i=1;i<=n;i++){
cin>>m[i];
for(j=1;j<=m[i];j++){
cin>>a[i][j];
}
}
for(i=1;i<=n;i++){
int v=0;
for(j=1;j<=n;j++){
if(j==i)continue;
if(m[i]<m[j])continue;
if(check(a[i],a[j],m[i],m[j])==1){v++;break;}
}
if(v==1)cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
using namespace std;
void qsort(int a[], int l, int r) {
   int i=l,j=r;
   int t;
   int m=a[(l+r)/2];
   while(i<=j){
   while(a[i]<m){
   i++;
   }
   while(a[j]>m){
   j--;
   }
   if(i<=j){
   swap(a[i],a[j]);
   i++;
   j--;
   }
   }
   if (l<j)qsort(a,l,j);
   if (i<r)qsort(a,i,r);
   }
int check(int a[],int b[],int n){
int c=0;
for(int i=1;i<=n;i++){
if(a[i]==b[i])c++;
}
if(c==n)return 1;
else return 2;
}
int main(){
int n,m[1000],a[500][500],i,j,l;
cin>>n;
for(i=1;i<=n;i++){
cin>>m[i];
for(j=1;j<=m[i];j++){
cin>>a[i][j];
}
qsort(a[i],1,m[i]);
}
for(i=1;i<=n;i++){
int v=0;
for(j=1;j<=n;j++){
if(j==i)continue;
if(m[i]<m[j])continue;
if(check(a[i],a[j],m[j])==1){v=1;break;}
}
if(v==1)cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return 0;
}


#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#define INF 1000000000
using namespace std;

int a[105][105];
int num[105];
int t[105];
int ok[105];

bool judge(int x,int y){
    if(num[y]>num[x]) return false;
    int i;
    for(i=1;i<=num[y];i++){
        if(a[x][i]!=a[y][i]) break;
    }
    if(i>num[y]) return true;
    return false;
}

int main(){
    int n,m;
    int i,j;
    int x;
    int cnt;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        //printf("i=%d\n",i);
        scanf("%d",&m);
        memset(t,0,sizeof(t));
        for(j=1;j<=m;j++){
            scanf("%d",&x);
            t[x]=1;
        }
        cnt=0;
        for(j=1;j<=100;j++){
            if(t[j]){
                cnt++;
                a[i][cnt]=j;
            }
        }
        num[i]=cnt;
    }
    for(i=1;i<=n;i++){
        ok[i]=1;
    }
    /*for(i=1;i<=n;i++){
        for(j=1;j<=num[i];j++){
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }*/
    //printf("aa\n");
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            if(i==j) continue;
            if(judge(i,j)){
                ok[i]=0;
                break;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(ok[i]){
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }
    }
    return 0;
}


#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#define INF 1000000000
using namespace std;

int a[105][105];
int mm[105][105];
int num[105];
int ok[105];
int t[105];

bool judge(int x,int y){
    int i,cnt=0;
    for(i=1;i<=num[y];i++){
        int gg=a[y][i];
        if(mm[x][gg]) cnt++;
    }
    if(cnt==num[y]) return true;
    return false;
}

int main(){
    int n,m;
    int i,j;
    int x;
    int cnt;
    scanf("%d",&n);
    memset(mm,0,sizeof(mm));
    for(i=1;i<=n;i++){
        scanf("%d",&m);
        for(j=1;j<=m;j++){
            scanf("%d",&t[j]);
        }
        sort(t+1,t+1+m);
        for(j=1;j<=m;j++){
            a[i][j]=t[j];
            mm[i][t[j]]=1;
        }
        num[i]=m;
    }
    for(i=1;i<=n;i++){
        ok[i]=1;
    }
    /*for(i=1;i<=n;i++){
        for(j=1;j<=num[i];j++){
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }*/
    //printf("aa\n");
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            if(i==j) continue;
            if(judge(i,j)){
                ok[i]=0;
                //printf("i=%d j=%d\n",i,j);
                break;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(ok[i]){
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }
    }
    return 0;
}


#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#define INF 1000000000
using namespace std;

int a[105][105];
int num[105];
int ok[105];
int t[105];

bool judge(int x,int y){
    if(num[y]>num[x]) return false;
    int i;
    for(i=1;i<=num[y];i++){
        if(a[x][i]!=a[y][i]) break;
    }
    if(i>num[y]) return true;
    return false;
}

int main(){
    int n,m;
    int i,j;
    int x;
    int cnt;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        //printf("i=%d\n",i);
        scanf("%d",&m);
        for(j=1;j<=m;j++){
            scanf("%d",&t[j]);
        }
        sort(t+1,t+1+m);
        for(j=1;j<=m;j++){
            a[i][j]=t[j];
        }
        num[i]=m;
    }
    for(i=1;i<=n;i++){
        ok[i]=1;
    }
    for(i=1;i<=n;i++){
        for(j=1;j<=num[i];j++){
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }
    //printf("aa\n");
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            if(i==j) continue;
            if(judge(i,j)){
                ok[i]=0;
                break;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(ok[i]){
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }
    }
    return 0;
}


#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#define INF 1000000000
using namespace std;

int a[105][105];
int num[105];
int ok[105];
int t[105];

bool judge(int x,int y){
    if(num[y]>num[x]) return false;
    int i;
    for(i=1;i<=num[y];i++){
        if(a[x][i]!=a[y][i]) break;
    }
    if(i>num[y]) return true;
    return false;
}

int main(){
    int n,m;
    int i,j;
    int x;
    int cnt;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        //printf("i=%d\n",i);
        scanf("%d",&m);
        for(j=1;j<=m;j++){
            scanf("%d",&t[j]);
        }
        sort(t+1,t+1+m);
        for(j=1;j<=m;j++){
            a[i][j]=t[j];
        }
        num[i]=m;
    }
    for(i=1;i<=n;i++){
        ok[i]=1;
    }
    /*for(i=1;i<=n;i++){
        for(j=1;j<=num[i];j++){
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }*/
    //printf("aa\n");
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            if(i==j) continue;
            if(judge(i,j)){
                ok[i]=0;
                break;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(ok[i]){
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
vector <int> B[200];
bool M[200];
bool check(int a,int b){
	if(B[b].size()>B[a].size()){

		return true;
	}
	if(B[b].size()<B[a].size()){
		for(int i=0;i<B[b].size();i++){
			if(B[b][i]!=B[a][i])
				return true;

		}
		return false;

	}
	for(int i=0;i<B[a].size();i++){
		if(B[b][i]!=B[a][i])
			return true;
	}
	return false;
}
void intialize(){
	for(int i=0;i<200;i++)
		M[i]=true;

}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		int A[200];
		for(int j=0;j<a;j++){
			int k;
			cin>>k;
			A[j]=k;
		}
		sort(A,A+a);
		for(int j=0;j<a;j++){
			B[i].push_back(A[j]);
		}
	}
	intialize();
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j)
				continue;
			if(!check(i,j)){
				M[i]=false;
			}
		}
	}
	for(int i=0;i<n;i++){
		if(M[i])
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;

	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
vector <int> B[200];
bool M[200];
bool check(int a,int b){
	if(B[b].size()>B[a].size()){

		return true;
	}
	if(B[b].size()<B[a].size()){
		for(int i=0;i<B[b].size();i++){
			if(B[b][i]!=B[a][i])
				return true;

		}
		return false;

	}
	for(int i=0;i<B[a].size();i++){
		if(B[b][i]!=B[a][i])
			return true;
	}
	return false;
}
void intialize(){
	for(int i=0;i<200;i++)
		M[i]=true;

}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		int A[200];
		for(int j=0;j<a;j++){
			int k;
			cin>>k;
			A[j]=k;
		}
		sort(A,A+a);
		for(int j=0;j<a;j++){
			B[i].push_back(A[j]);
		}
	}
	intialize();
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j)
				continue;
			if(!check(i,j)){
				cout<<i+1<<" "<<j+1<<endl;
				M[i]=false;
			}
		}
	}
	for(int i=0;i<n;i++){
		if(M[i])
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;

	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
vector <int> B[200];
bool M[200];
bool check(int a,int b){
	if(B[b].size()>B[a].size()){

		return true;
	}
	if(B[b].size()<B[a].size()){
		for(int i=0;i<B[b].size();i++){
			bool e=false;
			for(int j=0;j<B[a].size();j++)
				if(B[a][j]==B[b][i]){
					e=true;
					break;
				}
			if(!e)
				return true;

		}
		return false;

	}
	for(int i=0;i<B[a].size();i++){
		if(B[b][i]!=B[a][i])
			return true;
	}
	return false;
}
void intialize(){
	for(int i=0;i<200;i++)
		M[i]=true;

}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		int A[200];
		for(int j=0;j<a;j++){
			int k;
			cin>>k;
			A[j]=k;
		}
		sort(A,A+a);
		for(int j=0;j<a;j++){
			B[i].push_back(A[j]);
		}
	}
	intialize();
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j)
				continue;
			if(!check(i,j)){
				M[i]=false;
			}
		}
	}
	for(int i=0;i<n;i++){
		if(M[i])
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;

	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
vector <int> B[200];
bool M[200];
bool check(int a,int b){
	if(B[b].size()>B[a].size()){

		return true;
	}
	for(int i=0;i<a;i++){
		if(B[b][i]!=B[a][i])
			return true;
	}
	return false;
}
void intialize(){
	for(int i=0;i<200;i++)
		M[i]=true;

}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		int A[200];
		for(int j=0;j<a;j++){
			int k;
			cin>>k;
			A[i]=k;
		}
		sort(A,A+a);
		for(int j=0;j<a;j++){
			B[i].push_back(A[j]);
		}
	}
	intialize();
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j)
				continue;
			if(!check(i,j)){
				M[i]=false;
			}
		}
	}
	for(int i=0;i<n;i++){
		if(M[i])
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;

	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef vector<int> vi;

vi arr[150];

bool contain(vi a,vi b){

	int ret;

	for(int i=0;i<a.size();i++){

		ret=0;

		for(int j=0;j<b.size();j++)

		if(a[i]==b[j]) ret=1;

		if(!ret) return ret;

	}

	return ret;

}

int main(){

//	freopen("in.txt","r",stdin);

	int n,k,kk,p;

	cin>>n;

	for(int i=1;i<=n;i++) {

		scanf("%d",&k);

		for(int j=1;j<=k;j++) {

			scanf("%d",&kk);

			arr[i].push_back(kk);

		}

	}

	for(int i=1;i<=n;i++) {

		p=0;

		for(int j=1;j<=n;j++)

		if(j!=i && contain(arr[j],arr[i])) { puts("NO");  p=1; break;}

		if(p) continue;

		puts("YES");

	}

	return 0;

}


#include <bits/stdc++.h>

using namespace std;

#define MM 200

int n, tot[MM], a[MM][MM], ans[MM];

int main()

{

//	freopen ("in.txt", "r", stdin);

	scanf ("%d", &n);

	for (int i=0; i<n; i++){

		scanf ("%d", tot+i);

		for (int j=0; j<tot[i]; j++) scanf("%d", a[i]+j);

		sort(a[i], a[i]+tot[i]);

	}

	int ok=0;

	for (int i=0; i<n && ok!=2; i++){

		ok=0;

		for (int j=0; j<n; j++){

			if (i==j) continue;

			if(tot[i]<tot[j]) continue;

			int k;

			for (k=0; k<tot[j]; k++) if(a[i][k]!=a[j][k]) break;

			if(k>=tot[j] && tot[i]==tot[j]) {ok=2; break;}

			else if(k>=tot[j]) {ok=1; break;}

		}

		if(ok) ans[i]=1;

	}

	if(ok==2) for (int i=0; i<n; i++) puts("NO");

	else{ for (int i=0; i<n; i++){

		 	if(ans[i]) puts("NO");

		 	else puts("YES");

		  }

	}

	return 0;

}


#include <bits/stdc++.h>

using namespace std;

#define MM 200

int n, tot[MM], a[MM][MM], ans[MM];

int main()

{

//	freopen ("in.txt", "r", stdin);

	scanf ("%d", &n);

	for (int i=0; i<n; i++){

		scanf ("%d", tot+i);

		for (int j=0; j<tot[i]; j++) scanf("%d", a[i]+j);

		sort(a[i], a[i]+tot[i]);

	}

	int ok=0, f=0;

	for (int i=0; i<n && ok!=2; i++){

		ok=0; f=0;

		for (int j=0; j<n; j++){

			if (i==j) continue;

			if(tot[i]<tot[j]) continue;

			int k;

			for (k=0; k<tot[j]; k++) if(a[i][k]!=a[j][k]) break;

			if(k>=tot[j] && tot[i]==tot[j]) {f=1; continue;}

			if(k>=tot[j]) {ok=1; break;}

		}

		if(!ok && f==1) {ok=2; break;}

		if(ok) ans[i]=1;

	}

	if(ok==2) for (int i=0; i<n; i++) puts("NO");

	else{ for (int i=0; i<n; i++){

		 	if(ans[i]) puts("NO");

		 	else puts("YES");

		  }

	}

	return 0;

}


#include <bits/stdc++.h>

#define NN 100011

using namespace std;

typedef long long INT;

typedef pair<int, int> pii;

int flag[111][111], cnt[111], a[111][111], c[111];

int main() {

	int n,i,j;

	cin>>n;

	for(i=1; i<=n; i++){

		scanf("%d", cnt+i);

		for(j=0; j<cnt[i]; j++){

			scanf("%d", a[i]+j);

			flag[i][a[i][j]]=1;

		}

	}

	for(i=1; i<=n; i++){

		int ok=1;

		memset(c, 0, sizeof(c));

		for(j=0; j<cnt[i]; j++){

			for(int k=1; k<=n; k++){

				if(k==i) continue;

				if(flag[k][a[i][j]]) c[k]++;

				if(c[k]>=cnt[k]) ok=0;

			}

		}

		if(ok) puts("YES");

		else puts("NO");

	}

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

// Input macros
#define s(n)                        scanf("%d",&n)
#define _sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9

// Useful hardware instructions
#define bitcount                    __builtin_popcount

// Useful container manipulation / traversal macros
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define f                           first
#define sc                          second

#define SSTR( x ) dynamic_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str() // converting number (x) to string
#define SST(x) atoi(x) // converting a char array x to number

// Some common useful functions
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pp;
typedef vector<string> VS;

#define fr(i,s,n)    for(int i=s;i<(n);++i)
#define MOD 1000000007

int main()
{
#ifndef ONLINE_JUDGE
    freopen("ip.txt", "r", stdin);
    //freopen("op.txt", "w", stdout);
#endif

    int n;
    cin>>n;

    VVI a(n);

    int m,tmp;
    for(int i=0;i<n;++i)
    {
        cin>>m;
        for(int j=0;j<m;++j)
        {
            cin>>tmp;
            a[i].pb(tmp);
        }
        sort(all(a[i]));
    }

    int dp[n];
    int f;
    fr(i,0,n)
    {
        f=1;
        fr(j,0,n)
        {
            if(i==j)continue;
            int pos=0;
            for(int k=0;k<a[i].size()&& pos<a[j].size();++k)
            {
                if(a[i][k]==a[j][pos])
                {
                    pos++;
                }
            }
            if(pos==a[j].size())
            {
                f=0;
                break;
            }
        }
        dp[i]=f;
    }

    fr(i,0,n)
    {
        if(dp[i])cout<<"YES\n";
        else cout<<"NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

// Input macros
#define s(n)                        scanf("%d",&n)
#define _sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9

// Useful hardware instructions
#define bitcount                    __builtin_popcount

// Useful container manipulation / traversal macros
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define f                           first
#define sc                          second

#define SSTR( x ) dynamic_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str() // converting number (x) to string
#define SST(x) atoi(x) // converting a char array x to number

// Some common useful functions
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pp;
typedef vector<string> VS;

#define fr(i,s,n)    for(int i=s;i<(n);++i)
#define MOD 1000000007

int main()
{
#ifndef ONLINE_JUDGE
    freopen("ip.txt", "r", stdin);
    //freopen("op.txt", "w", stdout);
#endif

    int n;
    cin>>n;

    VVI a(n);

    int m,tmp;
    for(int i=0;i<n;++i)
    {
        cin>>m;
        for(int j=0;j<m;++j)
        {
            cin>>tmp;
            a[i].pb(tmp);
        }
        sort(all(a[i]));
    }

    int dp[n];
    int f;
    fr(i,0,n)
    {
        f=1;
        fr(j,0,n)
        {
            if(i==j)continue;
            int pos=0;
            for(int k=0;k<a[i].size()&& pos<a[j].size();++k)
            {
                if(a[i][k]==a[j][pos])
                {
                    pos++;
                }
                if(a[i][k]>a[j][pos])
                    break;
            }
            if(pos==a[j].size())
            {
                f=0;
                break;
            }
        }
        dp[i]=f;
    }

    fr(i,0,n)
    {
        if(dp[i])cout<<"YES\n";
        else cout<<"NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

// Input macros
#define s(n)                        scanf("%d",&n)
#define _sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9

// Useful hardware instructions
#define bitcount                    __builtin_popcount

// Useful container manipulation / traversal macros
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define f                           first
#define sc                          second

#define SSTR( x ) dynamic_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str() // converting number (x) to string
#define SST(x) atoi(x) // converting a char array x to number

// Some common useful functions
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pp;
typedef vector<string> VS;

#define fr(i,s,n)    for(int i=s;i<(n);++i)
#define MOD 1000000007

int main()
{
#ifndef ONLINE_JUDGE
    freopen("ip.txt", "r", stdin);
    //freopen("op.txt", "w", stdout);
#endif

    int n;
    cin>>n;

    int a[n][200];
    int b[n];

    int m,tmp;
    for(int i=0;i<n;++i)
    {
        cin>>b[i];
        int d[b[i]];
        for(int j=0;j<b[i];++j)
        {
            cin>>d[j];
        }
        sort(d,d+b[i]);
        for(int j=0;j<b[i];++j)
            a[i][j]=d[j];
    }

    int f;
    int dp[n];
    fill(dp,0);
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<n;++j)
        {
            if(i==j)continue;
            if(b[i]<b[j])continue;

            f=0;
            for(int k=0;k<b[j];++k)
            {
                if(a[i][k]!=a[j][k])
                {
                    f=1;
                    break;
                }
            }
            if(!f)break;
        }
        dp[i]=f;
    }

    for(int i=0;i<n;++i)
    {
        if(dp[i])cout<<"YES\n";
        else cout<<"NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

// Input macros
#define s(n)                        scanf("%d",&n)
#define _sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9

// Useful hardware instructions
#define bitcount                    __builtin_popcount

// Useful container manipulation / traversal macros
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define f                           first
#define sc                          second

#define SSTR( x ) dynamic_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str() // converting number (x) to string
#define SST(x) atoi(x) // converting a char array x to number

// Some common useful functions
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pp;
typedef vector<string> VS;

#define fr(i,s,n)    for(int i=s;i<(n);++i)
#define MOD 1000000007

int main()
{
#ifndef ONLINE_JUDGE
    freopen("ip.txt", "r", stdin);
    //freopen("op.txt", "w", stdout);
#endif

    int n;
    cin>>n;

    VVI a(n);

    int m,tmp;
    for(int i=0;i<n;++i)
    {
        cin>>m;
        for(int j=0;j<m;++j)
        {
            cin>>tmp;
            a[i].pb(tmp);
        }
        sort(all(a[i]));
    }

    int dp[n];
    int f;
    fr(i,0,n)
    {
        f=1;
        fr(j,0,n)
        {
            if(i==j)continue;

            int cnt=0;
            for(int k=0;k<a[j].size();++k)
            {
                for(int p=0;p<a[i].size();++p)
                {
                    if(a[i][p]==a[j][k])
                        cnt++;
                }
            }
            if(cnt==a[j].size())
            {
                f=0;
                break;
            }

        }
        dp[i]=f;
    }

    fr(i,0,n)
    {
        if(dp[i])cout<<"YES\n";
        else cout<<"NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

// Input macros
#define s(n)                        scanf("%d",&n)
#define _sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9

// Useful hardware instructions
#define bitcount                    __builtin_popcount

// Useful container manipulation / traversal macros
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define f                           first
#define sc                          second

#define SSTR( x ) dynamic_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str() // converting number (x) to string
#define SST(x) atoi(x) // converting a char array x to number

// Some common useful functions
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pp;
typedef vector<string> VS;

#define fr(i,s,n)    for(int i=s;i<(n);++i)
#define MOD 1000000007

int main()
{
#ifndef ONLINE_JUDGE
    freopen("ip.txt", "r", stdin);
    //freopen("op.txt", "w", stdout);
#endif

    int n;
    cin>>n;

    int a[n][200];
    int b[n];

    int m,tmp;
    for(int i=0;i<n;++i)
    {
        cin>>b[i];
        int d[b[i]];
        for(int j=0;j<b[i];++j)
        {
            cin>>d[j];
        }
        sort(d,d+b[i]);
        for(int j=0;j<b[i];++j)
            a[i][j]=d[j];
    }

    int f;
    int dp[n];
    fill(dp,0);
    for(int i=0;i<n;++i)
    {
        f=1;
        for(int j=0;j<n;++j)
        {
            if(i==j)continue;
            if(b[i]<b[j])continue;

            f=0;
            for(int k=0;k<b[j];++k)
            {
                if(a[i][k]!=a[j][k])
                {
                    f=1;
                    break;
                }
            }
            if(!f)break;
        }
        dp[i]=f;
    }

    for(int i=0;i<n;++i)
    {
        if(dp[i]==1)cout<<"YES\n";
        else cout<<"NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

// Input macros
#define s(n)                        scanf("%d",&n)
#define _sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9

// Useful hardware instructions
#define bitcount                    __builtin_popcount

// Useful container manipulation / traversal macros
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define f                           first
#define sc                          second

#define SSTR( x ) dynamic_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str() // converting number (x) to string
#define SST(x) atoi(x) // converting a char array x to number

// Some common useful functions
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pp;
typedef vector<string> VS;

#define fr(i,s,n)    for(int i=s;i<(n);++i)
#define MOD 1000000007

int main()
{
#ifndef ONLINE_JUDGE
   // freopen("ip.txt", "r", stdin);
    //freopen("op.txt", "w", stdout);
#endif

    int n;
    cin>>n;

    int a[n][200];
    int b[n];

    int m,tmp;
    for(int i=0;i<n;++i)
    {
        cin>>b[i];
        for(int j=0;j<b[i];++j)
        {
            cin>>a[i][j];
        }
        sort(a[i],a[i]+b[i]);
    }

    int f;
    int dp[n];
    fill(dp,0);
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<n;++j)
        {
            if(i==j)continue;
            if(b[i]<b[j])continue;

            f=0;
            for(int k=0;k<b[j];++k)
            {
                if(a[i][k]!=a[j][k])
                {
                    f=1;
                    break;
                }
            }
            if(!f)break;
        }
        dp[i]=f;
    }

    for(int i=0;i<n;++i)
    {
        if(dp[i])cout<<"YES\n";
        else cout<<"NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

// Input macros
#define s(n)                        scanf("%d",&n)
#define _sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9

// Useful hardware instructions
#define bitcount                    __builtin_popcount

// Useful container manipulation / traversal macros
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define f                           first
#define sc                          second

#define SSTR( x ) dynamic_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str() // converting number (x) to string
#define SST(x) atoi(x) // converting a char array x to number

// Some common useful functions
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pp;
typedef vector<string> VS;

#define fr(i,s,n)    for(int i=s;i<(n);++i)
#define MOD 1000000007

int main()
{
#ifndef ONLINE_JUDGE
    freopen("ip.txt", "r", stdin);
    //freopen("op.txt", "w", stdout);
#endif

    int n;
    cin>>n;

    int a[n][200];
    int b[n];

    int m,tmp;
    for(int i=0;i<n;++i)
    {
        cin>>b[i];
        int d[b[i]];
        for(int j=0;j<b[i];++j)
        {
            cin>>d[j];
        }
        sort(d,d+b[i]);
        for(int j=0;j<b[i];++j)
            a[i][j]=d[j];
    }

    int f;
    int dp[n];
    fill(dp,0);
    for(int i=0;i<n;++i)
    {
        f=1;
        for(int j=0;j<n;++j)
        {
            if(i==j)continue;
            if(b[i]<b[j])continue;

            int pos=0;

            for(int k=0;k<b[i] && pos<b[j];++k)
            {
                if(a[i][k]==a[j][pos])
                {
                    pos++;
                }
            }
            if(pos==b[j])
            {
                f=0;
                break;
            }

        }
        dp[i]=f;
    }

    for(int i=0;i<n;++i)
    {
        if(dp[i]==1)cout<<"YES\n";
        else cout<<"NO\n";
    }

    return 0;
}


#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<stack>
#include<vector>
#include<deque>
#include<queue>
#include<bitset>
#include<set>

using namespace std;

struct C{
    vector<int> numbers;
    int size,id;
};

bool cmp_size(C a,C b)
{
    return a.size<b.size;
}

bool cmp_id(C a,C b)
{
    return a.id<b.id;
}

int main()
{
    bool flag;
    int n,m,x,i,j,count;
    vector<C> cards;
    C card;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        card.size=m;
        card.id=i;
        card.numbers.clear();
        for(j=0;j<m;j++)
        {
            cin>>x;
            card.numbers.push_back(x);
        }
        sort(card.numbers.begin(),card.numbers.end());
        cards.push_back(card);
    }
    sort(cards.begin(),cards.end(),cmp_size);
    for(i=0;i<=n;i++)
    {
        flag=false;
        if(cards[i].size==0)
            continue;
        for(j=i+1;j<n;j++)
        {
            if(cards[j].size==0)
                continue;
            count=0;
            while(count<cards[i].size)
            {
                if(cards[i].numbers[count]==cards[j].numbers[count])
                    count++;
                else
                    break;
            }
            if(count==cards[i].size)
            {
                if(cards[j].size==count)
                    flag=true;
                cards[j].size=0;
            }
        }
        if(flag)
            cards[i].size=0;
    }
    sort(cards.begin(),cards.end(),cmp_id);
    for(i=0;i<n;i++)
    {
        if(cards[i].size==0)
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }
    return 0;
}


#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<stack>
#include<vector>
#include<deque>
#include<queue>
#include<bitset>
#include<set>

using namespace std;

struct C{
    vector<int> numbers;
    int size,id;
};

bool cmp_size(C a,C b)
{
    return a.size<b.size;
}

bool cmp_id(C a,C b)
{
    return a.id<b.id;
}

int main()
{
    bool flag;
    int n,m,x,i,j,count,k;
    vector<C> cards;
    C card;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        card.size=m;
        card.id=i;
        card.numbers.clear();
        for(j=0;j<m;j++)
        {
            cin>>x;
            card.numbers.push_back(x);
        }
        sort(card.numbers.begin(),card.numbers.end());
        cards.push_back(card);
    }
    sort(cards.begin(),cards.end(),cmp_size);
    for(i=0;i<=n;i++)
    {
        flag=false;
        if(cards[i].size==0)
            continue;
        for(j=i+1;j<n;j++)
        {
            if(cards[j].size==0)
                continue;
            count=0;
            k=0;
            while(k<cards[j].size)
            {
                if(cards[j].numbers[k]<cards[i].numbers[0])
                    k++;
                else
                    break;
            }
            if(k==cards[j].size)
                continue;
            while(count<cards[i].size&&k<cards[j].size)
            {
                if(cards[i].numbers[count]==cards[j].numbers[k])
                {
                    count++;
                    k++;
                }
                else
                    break;
            }
            if(count==cards[i].size)
            {
                if(cards[j].size==count)
                    flag=true;
                cards[j].size=0;
            }
        }
        if(flag)
            cards[i].size=0;
    }
    sort(cards.begin(),cards.end(),cmp_id);
    for(i=0;i<n;i++)
    {
        if(cards[i].size==0)
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }
    return 0;
}


#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<stack>
#include<vector>
#include<deque>
#include<queue>
#include<bitset>
#include<set>

using namespace std;

struct C{
    vector<int> numbers;
    int size,id;
};

bool cmp_size(C a,C b)
{
    return a.size<b.size;
}

bool cmp_id(C a,C b)
{
    return a.id<b.id;
}

int main()
{
    bool flag;
    int n,m,x,i,j,count,k;
    vector<C> cards;
    C card;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        card.size=m;
        card.id=i;
        card.numbers.clear();
        for(j=0;j<m;j++)
        {
            cin>>x;
            card.numbers.push_back(x);
        }
        sort(card.numbers.begin(),card.numbers.end());
        cards.push_back(card);
    }
    sort(cards.begin(),cards.end(),cmp_size);
    for(i=0;i<n;i++)
    {
        flag=false;
        if(cards[i].size==0)
            continue;
        for(j=i+1;j<n;j++)
        {
            if(cards[j].size==0)
                continue;
            count=0;
            k=0;
            while(k<cards[j].size)
            {
                if(cards[j].numbers[k]!=cards[i].numbers[0])
                    k++;
                else
                    break;
            }
            if(k==cards[j].size)
                continue;
            while(count<cards[i].size&&k<cards[j].size)
            {
                if(cards[i].numbers[count]==cards[j].numbers[k])
                    count++;
                k++;
            }
            if(count==cards[i].size)
            {
                if(cards[j].size==count)
                    flag=true;
                cards[j].size=0;
            }
        }
        if(flag)
            cards[i].size=0;
    }
    sort(cards.begin(),cards.end(),cmp_id);
    for(i=0;i<n;i++)
    {
        if(cards[i].size==0)
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }
    return 0;
}


#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<stack>
#include<vector>
#include<deque>
#include<queue>
#include<bitset>
#include<set>

using namespace std;

struct C{
    vector<int> numbers;
    int size,id;
};

bool cmp_size(C a,C b)
{
    return a.size<b.size;
}

bool cmp_id(C a,C b)
{
    return a.id<b.id;
}

int main()
{
    bool flag;
    int n,m,x,i,j,count,k;
    vector<C> cards;
    C card;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        card.size=m;
        card.id=i;
        card.numbers.clear();
        for(j=0;j<m;j++)
        {
            cin>>x;
            card.numbers.push_back(x);
        }
        sort(card.numbers.begin(),card.numbers.end());
        cards.push_back(card);
    }
    sort(cards.begin(),cards.end(),cmp_size);
    for(i=0;i<=n;i++)
    {
        flag=false;
        if(cards[i].size==0)
            continue;
        for(j=i+1;j<n;j++)
        {
            if(cards[j].size==0)
                continue;
            count=0;
            k=0;
            while(k<cards[j].size)
            {
                if(cards[j].numbers[k]!=cards[i].numbers[0])
                    k++;
                else
                    break;
            }
            if(k==cards[j].size)
                continue;
            while(count<cards[i].size&&k<cards[j].size)
            {
                if(cards[i].numbers[count]==cards[j].numbers[k])
                {
                    count++;
                    k++;
                }
                else
                    break;
            }
            if(count==cards[i].size)
            {
                if(cards[j].size==count)
                    flag=true;
                cards[j].size=0;
            }
        }
        if(flag)
            cards[i].size=0;
    }
    sort(cards.begin(),cards.end(),cmp_id);
    for(i=0;i<n;i++)
    {
        if(cards[i].size==0)
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef unsigned long long ULL;

#define bzero(a,b) memset((a), 0, (b))

struct Set128 {
  ULL a[2];

  Set128() {
    bzero(a, sizeof(a));
  }

  void clear();
  void set(int offset);
  bool equal(Set128 &s);
  bool child(Set128 &s);
};

int main()
{
  // freopen("b.sample.in", "r", stdin);
  int n, m, a;
  Set128 set[100];
  bool lose[100];

  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i ++) {
      scanf("%d", &m);
      set[i].clear();
      for (int j = 0; j < m; j ++) {
        scanf("%d", &a);
        // assert(a >= 0 && a <= 100);
        set[i].set(a);
      }
    }

    bzero(lose, sizeof(lose));
    for (int i = 0; i < n; i ++) {
      for (int j = i + 1; j < n; j ++) {
        if (set[i].equal(set[j])) {
          lose[i] = 1;
          lose[j] = 1;
          // printf("got both: %d %d\n", i, j);
        } else if (set[i].child(set[j])) {
          lose[j] = 1;
          // printf("got %d: %d %d\n", j, i, j);
        } else if (!lose[i] && set[j].child(set[i])) {
          lose[i] = 1;
          // printf("got %d: %d %d\n", i, i, j);
        }
      }
      printf("%s\n", lose[i] ? "NO" : "YES");
    }
  }
  return 0;
}

void Set128::clear() {
    bzero(a, sizeof(a));
}

void Set128::set(int offset) {
  if (offset <= 63) {
    a[0] |= (ULL)(1 << offset);
  } else {
    a[1] |= (ULL)(1 << (offset - 63));
  }
}

bool Set128::equal(Set128 &s) {
  return (a[0] == s.a[0] && a[1] == s.a[1]);
}

bool Set128::child(Set128 &s) {
  ULL t[2];
  t[0] = (a[0] | (ULL)s.a[0]) ^ s.a[0];
  t[1] = (a[1] | (ULL)s.a[1]) ^ s.a[1];
  return (t[0] == 0 && t[1] == 0);
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef unsigned long long ULL;

#define bzero(a,b) memset((a), 0, (b))

struct Set128 {
  ULL a[2];

  Set128() {
    bzero(a, sizeof(a));
  }

  void clear();
  void set(int offset);
  bool equal(Set128 &s);
  bool child(Set128 &s);
};

int main()
{
  // freopen("b.sample.in", "r", stdin);
  int n, m, a;
  Set128 set[100];
  bool lose[100];

  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i ++) {
      scanf("%d", &m);
      set[i].clear();
      for (int j = 0; j < m; j ++) {
        scanf("%d", &a);
        // assert(a >= 0 && a <= 100);
        set[i].set(a);
      }
    }

    bzero(lose, sizeof(lose));
    for (int i = 0; i < n; i ++) {
      for (int j = i + 1; j < n; j ++) {
        if (set[i].equal(set[j])) {
          lose[i] = 1;
          lose[j] = 1;
          // printf("got both: %d %d\n", i, j);
        } else if (set[i].child(set[j])) {
          lose[j] = 1;
          //  printf("got %d: %d %d\n", j, i, j);
        } else if (!lose[i] && set[j].child(set[i])) {
          lose[i] = 1;
          // printf("got %d: %d %d\n", i, i, j);
        }
      }
      printf("%s\n", lose[i] ? "NO" : "YES");
    }
  }
  return 0;
}

void Set128::clear() {
    bzero(a, sizeof(a));
}

void Set128::set(int offset) {
  if (offset <= 63) {
    a[0] |= (1 << offset);
  } else {
    a[1] |= (1 << (offset - 63));
  }
}

bool Set128::equal(Set128 &s) {
  return (a[0] == s.a[0] && a[1] == s.a[1]);
}

bool Set128::child(Set128 &s) {
  ULL t[2];
  t[0] = (a[0] | s.a[0]) ^ s.a[0];
  t[1] = (a[1] | s.a[1]) ^ s.a[1];
  return (t[0] == 0 && t[1] == 0);
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef unsigned long long ULL;

#define bzero(a,b) memset((a), 0, (b))

struct Set128 {
  ULL a[2];

  Set128() {
    bzero(a, sizeof(a));
  }

  void clear();
  void set(int offset);
  bool equal(Set128 &s);
  bool child(Set128 &s);
};

int main()
{
  // freopen("b.sample.in", "r", stdin);
  int n, m, a;
  Set128 set[100];
  bool lose[100];
  int count = 0;

  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i ++) {
      scanf("%d", &m);
      set[i].clear();
      for (int j = 0; j < m; j ++) {
        scanf("%d", &a);
        set[i].set(a);
      }
    }
    if (++count == 18) {
      ULL found = 0;
      for (int i = 0; i < n; i++) {
        for (int j = 1; j < 100; j ++) {
          if (j <= 63) {
            found = set[i].a[0] & ((ULL)1 << (j - 1));
            if (found) printf("%d ", j);
          } else {
            found = set[i].a[0] & ((ULL)1 << (j - 64));
            if (found) printf("%d ", j);
          }
        }
        printf("\n");
      }
    }

    bzero(lose, sizeof(lose));
    for (int i = 0; i < n; i ++) {
      for (int j = i + 1; j < n; j ++) {
        if (set[i].equal(set[j])) {
          lose[i] = 1;
          lose[j] = 1;
          // printf("got both: %d %d\n", i, j);
        } else if (set[i].child(set[j])) {
          lose[j] = 1;
          // printf("got %d: %d %d\n", j, i, j);
        } else if (!lose[i] && set[j].child(set[i])) {
          lose[i] = 1;
          // printf("got %d: %d %d\n", i, i, j);
        }
      }
      printf("%s\n", lose[i] ? "NO" : "YES");
    }
    printf("\n");
  }
  return 0;
}

void Set128::clear() {
    bzero(a, sizeof(a));
}

void Set128::set(int offset) {
  if (offset <= 63) {
    a[0] |= (ULL)1 << (offset - 1);
  } else {
    a[1] |= (ULL)1 << (offset - 64);
  }
}

bool Set128::equal(Set128 &s) {
  return (a[0] == s.a[0] && a[1] == s.a[1]);
}

bool Set128::child(Set128 &s) {
  ULL t[2];
  t[0] = (a[0] | s.a[0]) ^ s.a[0];
  t[1] = (a[1] | s.a[1]) ^ s.a[1];
  return (t[0] == 0 && t[1] == 0);
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef unsigned long long ULL;

#define bzero(a,b) memset((a), 0, (b))

struct Set128 {
  ULL a[2];

  Set128() {
    bzero(a, sizeof(a));
  }

  void clear();
  void set(int offset);
  bool equal(Set128 &s);
  bool child(Set128 &s);
};

int main()
{
  // freopen("b.sample.in", "r", stdin);
  int n, m, a;
  Set128 set[100];
  bool lose[100];

  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i ++) {
      scanf("%d", &m);
      set[i].clear();
      for (int j = 0; j < m; j ++) {
        scanf("%d", &a);
        // assert(a >= 0 && a <= 100);
        set[i].set(a);
      }
    }

    bzero(lose, sizeof(lose));
    for (int i = 0; i < n; i ++) {
      for (int j = i + 1; j < n; j ++) {
        if (set[i].equal(set[j])) {
          lose[i] = 1;
          lose[j] = 1;
          // printf("got both: %d %d\n", i, j);
        } else if (set[i].child(set[j])) {
          lose[j] = 1;
          // printf("got %d: %d %d\n", j, i, j);
        } else if (!lose[i] && set[j].child(set[i])) {
          lose[i] = 1;
          // printf("got %d: %d %d\n", i, i, j);
        }
      }
      printf("%s\n", lose[i] ? "NO" : "YES");
    }
    // printf("\n");
  }
  return 0;
}

void Set128::clear() {
    bzero(a, sizeof(a));
}

void Set128::set(int offset) {
  if (offset <= 63) {
    a[0] |= (ULL)(1 << (offset - 1));
  } else {
    a[1] |= (ULL)(1 << (offset - 64));
  }
}

bool Set128::equal(Set128 &s) {
  return (a[0] == s.a[0] && a[1] == s.a[1]);
}

bool Set128::child(Set128 &s) {
  ULL t[2];
  t[0] = (a[0] | (ULL)s.a[0]) ^ s.a[0];
  t[1] = (a[1] | (ULL)s.a[1]) ^ s.a[1];
  return (t[0] == 0 && t[1] == 0);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
vector<int>b[10000];
string res[100000];
int main()
{
   // freopen("in.txt","r",stdin);
    int n,m,x;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>m;
        for(int j=0;j<m;j++)
        {
            cin>>x;
            b[i].push_back(x);

        }
    }
    for(int i=0;i<n;i++)
        res[i]="YES";
    for(int i=0;i<n;i++)
    {
        sort(b[i].begin(),b[i].end());
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            int count=0;
            if(!res[j].compare("YES"))
            {
                if(b[i].size()==b[j].size())
                {
                    for(int k=0;k<b[i].size();k++)
                    {
                        if(b[i][k]==b[j][k])
                        {
                            count++;

                        }
                    }
                    if(count==b[i].size())
                    {
                        res[i]="NO";
                        res[j]="NO";
                    }
                }
                else if(b[i].size()<b[j].size())
                {
                    int ind=0;
                    for(int k=0;k<b[i].size();k++)
                    {
                        for(int l=0;l<b[j].size();l++)
                        {
                            if(b[i][k]==b[j][l])
                            {
                                ind++;
                                break;
                            }

                        }

                    }
                    if(ind==b[i].size())
                    {
                        res[j]="NO";
                    }

                }
                else
                {
                    int ind=0;
                    for(int k=0;k<b[j].size();k++)
                    {
                        for(int l=0;l<b[i].size();l++)
                        {
                            if(b[j][k]==b[i][l])
                            {
                                ind++;
                                break;
                            }
                        }
                        if(ind==b[j].size())
                        {
                            res[i]="NO";
                        }
                    }
                }
            }

        }
    }
    for(int i=0;i<n;i++)
        cout<<res[i]<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
vector<int>b[10000];
string res[100000];
int main()
{
    //freopen("in.txt","r",stdin);
    int n,m,x;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>m;
        for(int j=0;j<m;j++)
        {
            cin>>x;
            b[i].push_back(x);

        }
    }
    for(int i=0;i<n;i++)
        res[i]="YES";
    for(int i=0;i<n;i++)
    {
        sort(b[i].begin(),b[i].end());
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            int count=0;
            if(!res[j].compare("YES"))
            {
                if(b[i].size()==b[j].size())
                {
                    for(int k=0;k<b[i].size();k++)
                    {
                        if(b[i][k]==b[j][k])
                        {
                            count++;

                        }
                    }
                    if(count==b[i].size())
                    {
                        res[i]="NO";
                        res[j]="NO";
                    }
                }
                else if(b[i].size()<b[j].size())
                {
                    for(int k=0;k<b[i].size();k++)
                    {
                        if(b[i][k]==b[j][k])
                        {
                            count++;
                        }
                    }
                    if(count==b[i].size())
                    {
                        res[j]="NO";
                    }

                }
                else
                {
                    for(int k=0;k<b[j].size();k++)
                    {
                        if(b[j][k]==b[i][k])
                        {
                            count++;
                        }

                    }
                    if(count==b[j].size())
                    {
                        res[i]="NO";
                    }
                }
            }

        }
    }
    for(int i=0;i<n;i++)
        cout<<res[i]<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
vector<int>b[10000];
string res[100000];
int main()
{
  //  freopen("in.txt","r",stdin);
    int n,m,x;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>m;
        for(int j=0;j<m;j++)
        {
            cin>>x;
            b[i].push_back(x);

        }
    }
    for(int i=0;i<n;i++)
        res[i]="YES";
    for(int i=0;i<n;i++)
    {
        sort(b[i].begin(),b[i].end());
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            int count=0;
            if(!res[j].compare("YES"))
            {
                if(b[i].size()==b[j].size())
                {
                    for(int k=0;k<b[i].size();k++)
                    {
                        if(b[i][k]==b[j][k])
                        {
                            count++;

                        }
                    }
                    if(count==b[i].size())
                    {
                        res[i]="NO";
                        res[j]="NO";
                    }
                }
                else if(b[i].size()<b[j].size())
                {
                    int ind;
                    for(int k=0;k<b[j].size();k++)
                    {
                        if(b[i][0]==b[j][k])
                        {
                            ind=k;
                            //cout<<"ind: "<<ind<<endl;
                            for(int l=ind,m=0;m<b[i].size();l++,m++)
                            {
                                if(b[i][m]==b[j][l])
                                    count++;
                            }
                            //cout<<"here: "<<count<<endl;

                            if(count==b[i].size())
                            {
                                res[j]="NO";
                                break;

                            }
                        }
                    }

                }
                else
                {
                    int ind;
                    for(int k=0;k<b[i].size();k++)
                    {
                        if(b[j][0]==b[i][k])
                        {
                            ind=k;
                            for(int l=ind,m=0;m<b[j].size();l++,m++)
                            {
                                if(b[i][l]==b[j][m])
                                    count++;
                            }
                            if(count==b[j].size())
                            {
                                res[i]="NO";
                                break;

                            }
                        }
                    }
                }
            }

        }
    }
    for(int i=0;i<n;i++)
        cout<<res[i]<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define sd(n) scanf("%d",&n)
int n,ar[109][109],fol[109]={};
bool check(int a, int b)
{
    memset(fol,0,sizeof(fol));
    int i;
    for(i=1; i<=ar[a][0]; i++)
        fol[ar[a][i]]=1;
    for(i=1; i<=ar[b][0]; i++)
        if(fol[ar[b][i]]==0)return false;
    return true;
}
int main()
{
    int flag=0,i,j;
    sd(n);
    for(i=0; i<n; i++)
    {
        sd(ar[i][0]);
        for(j=1; j<=ar[i][0]; j++)
            sd(ar[i][j]);
    }
    for(i=0; i<n; i++)
    {
        flag=0;
        for(j=0; j<n; j++)
        {
            if(i==j)continue;
            if(check(i,j))
            {
                printf("NO\n");
                flag=1;
                break;
            }
        }
        if(flag==0)
            printf("YES\n");
    }
    return 0;
}

/*int main ()
{
	int n,i;
	cin>>n;
	int a[n];
	int m[110][110]={0};
	for (i=0;i<n;i++)
	{
		cin>>a[i];
		for (j=0;j<a[i];j++)
		{
			cin>>m[i][j];
		}
	}
	return 0;
}*/


#include<bits/stdc++.h>
using namespace std;
#define sd(n) scanf("%d",&n)

int n,ar[109][109],fol[109]={};
bool check(int a, int b)
{
    memset(fol,0,sizeof(fol));
    int i;
    for(i=1; i<=ar[a][0]; i++)
        fol[ar[a][i]]=1;
    for(i=1; i<=ar[b][0]; i++)
        if(fol[ar[b][i]]==0)return false;
    return true;
}
int main()
{
    int flag=0,i,j;
    sd(n);
    for(i=0; i<n; i++)
    {
        sd(ar[i][0]);
        for(j=1; j<=ar[i][0]; j++)
            sd(ar[i][j]);
    }
    for(i=0; i<n; i++)
    {
        flag=0;
        for(j=0; j<n; j++)
        {
            //if(i==j)continue;
            if(check(i,j))
            {
                printf("NO\n");
                flag=1;
                break;
            }
        }
        if(flag==0)
            printf("YES\n");
    }
    return 0;
}

/*int main ()
{
	int n,i;
	cin>>n;
	int a[n];
	int m[110][110]={0};
	for (i=0;i<n;i++)
	{
		cin>>a[i];
		for (j=0;j<a[i];j++)
		{
			cin>>m[i][j];
		}
	}
	return 0;
}*/


#include<bits/stdc++.h>
using namespace std;
#define sd(n) scanf("%d",&n)

int n,ar[109][109],fol[109]={0};
bool check(int a, int b)
{
    //memset(fol,0,sizeof(fol));
    int i;
    for(i=1; i<=ar[a][0]; i++)
        fol[ar[a][i]]=1;
    for(i=1; i<=ar[b][0]; i++)
        if(fol[ar[b][i]]==0)return false;
    return true;
}
int main()
{
    int flag=0,i,j;
    sd(n);
    for(i=0; i<n; i++)
    {
        sd(ar[i][0]);
        for(j=1; j<=ar[i][0]; j++)
            sd(ar[i][j]);
    }
    for(i=0; i<n; i++)
    {
        flag=0;
        for(j=0; j<n; j++)
        {
            if(i==j)continue;
            if(check(i,j))
            {
                printf("NO\n");
                flag=1;
                break;
            }
        }
        if(flag==0)
            printf("YES\n");
    }
    return 0;
}

/*int main ()
{
	int n,i;
	cin>>n;
	int a[n];
	int m[110][110]={0};
	for (i=0;i<n;i++)
	{
		cin>>a[i];
		for (j=0;j<a[i];j++)
		{
			cin>>m[i][j];
		}
	}
	return 0;
}*/


#include<bits/stdc++.h>
using namespace std;
#define sd(n) scanf("%d",&n)

int n,ar[109][109],fol[109]={};
bool check(int a, int b)
{
    memset(fol,0,sizeof(fol));
    int i;
    for(i=1; i<=ar[a][0]; i++)
        fol[ar[a][i]]=1;
    for(i=1; i<=ar[b][0]; i++)
        if(fol[ar[b][i]]==0)return false;
    return true;
}
int main()
{
    int flag=0,i,j;
    sd(n);
    for(i=0; i<n; i++)
    {
        sd(ar[i][0]);
        for(j=1; j<=ar[i][0]; j++)
            sd(ar[i][j]);
    }
    for(i=0; i<n; i++)
    {
        flag=0;
        for(j=0; j<n; j++)
        {
            if(i==j)continue;
            if(check(i,j))
            {
                printf("NO\n");
                flag=1;
                break;
            }
        }
        if(flag==0)
            printf("YES\n");
    }
    return 0;
}

/*int main ()
{
	int n,i;
	cin>>n;
	int a[n];
	int m[110][110]={0};
	for (i=0;i<n;i++)
	{
		cin>>a[i];
		for (j=0;j<a[i];j++)
		{
			cin>>m[i][j];
		}
	}
	return 0;
}*/


#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    freopen("LAPPHUONG.INP", "r", stdin);
    freopen("LAPPHUONG.OUT", "w", stdout);
    int n, dp[10005];
    dp[0] = 0;
    cin>>n;
    for(int i = n; i >= 1; i--) dp[i] = i;
    for(int i = 1; i <= n; i++){
            for(int j = 1; j*j*j <= i; j++){
                    if(j <= 10) dp[i] = min(dp[i], dp[i - j*j*j] + 1);
            }
    }
    cout<<dp[n]<<endl;
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstdio>

using namespace std;

int main()
{
    freopen("LAPPHUONG.INP", "r", stdin);
    freopen("LAPPHUONG.OUT", "w", stdout);
    int n, dp[10005];
    dp[0] = 0;
    cin>>n;
    for(int i = n; i >= 1; i--) dp[i] = i;
    for(int i = 1; i <= n; i++){
            for(int j = 1; j*j*j <= i; j++){
                    if(j <= 10) dp[i] = min(dp[i], dp[i - j*j*j] + 1);
            }
    }
    cout<<dp[n]<<endl;
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    freopen("LAPPHUONG.INP", "r", stdin);
    freopen("LAPPHUONG.OUT", "w", stdout);
    int n, dp[10005];
    dp[0] = 0;
    cin>>n;
    for(int i = n; i >= 1; i--) dp[i] = i;
    for(int i = 1; i <= n; i++){
            for(int j = 1; j*j*j <= i; j++){
                    if(j <= 10) dp[i] = min(dp[i], dp[i - j*j*j] + 1);
            }
    }
    cout<<dp[n]<<endl;
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>

using namespace std;

int n, amount[105], number[105][105], mark[105], check[105][105];
int main()
{
  //  freopen("XOSO.INP", "r", stdin);
   // freopen("XOSO.OUT", "w", stdout);
    cin>>n;
    for(int i = 1; i <= n; i++){
        cin>>amount[i];
        for(int j = 1; j <= amount[i]; j++){
            cin>>number[i][j];
            check[i][number[i][j]]++;
        }
    }
    for(int i = 1; i <= n; i++){
           int flag = 0;
           for(int j = 1; j <= n; j++){
               if(i != j){
                   if(amount[i] >= amount[j]){
                       int tmp = 0;
                       for(int k = 1; k <= 100; k++){
                           if(check[i][k] >= check[j][k]) tmp++;
                       }
                       if(tmp == 100) flag++;
                   }
               }
           }
           if(flag > 0) mark[i] = 1;
           else mark[i] = 0;
    }
    for(int i = 1; i <= n; i++){
            if(mark[i] == 1) cout<<"NO"<<endl;
            else cout<<"YES"<<endl;
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>

using namespace std;

int n, a[105], b[105][105], mark[105], c[105][105];
int main()
{
    cin>>n;
    for(int i = 1; i <= n; i++){
        cin>>a[i];
        for(int j = 1; j <= a[i]; j++){
            cin>>b[i][j];
            c[i][b[i][j]]++;
        }
    }
    for(int i = 1; i <= n; i++){
           int flag = 0;
           for(int j = 1; j <= n; j++){
               if(i != j){
                   if(a[i] >= a[j]){
                       int tmp = 0;
                       for(int k = 1; k <= 100; k++){
                           if(c[i][k] >= c[j][k]) tmp++;
                       }
                       if(tmp == 100) flag++;
                   }
               }
           }
           if(flag > 0) mark[i] = 1;
           else mark[i] = 0;
    }
    for(int i = 1; i <= n; i++) if(mark[i] == 1) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int m, a, b;

int find_hours(int x){
   int res = x;
   while(x >= m){
             int tmp = x / m;
             res += tmp;
             x = tmp + (x % m);
    }
    return res;
}

int max_hours(int t){
    return (pow((float)m,(float)t+1)-1)/(m-1);
}

int candles(int t){
    return pow((float)m,(float)t);
}

int main()
{
    freopen("DOTNEN.INP", "r", stdin);
    freopen("DOTNEN.OUT", "w", stdout);
    cin>>m>>a>>b;
    cout<<find_hours(a)<<" ";
    int k = 0;
    while(max_hours(k) <= b){
       k++;
    }
    k--;
    int res = 0;
    for(int i = candles(k); i <= candles(k+1); i++){
            if(find_hours(i) >= b){
                           res = i;
                           break;
            }
    }
    cout<<res<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<cstring>
#include<set>
#include<utility>
#include<deque>
using namespace std;

#define mod 1000000007
#define rep(i,k,n) for(i=k;i<n;i++)
#define ip(a) freopen(a,"r",stdin)
#define out(b) freopen("b","w",stdout)

int main()
{
//    ip("in.txt");
int n,m;
cin>>n;
int i;
int j,k,p;
vector<int>vt[n];
bool **h=new bool *[n];
rep(i,0,n)
{
 cin>>m;
 h[i]=new bool[101];
 rep(k,0,101)
   h[i][k]=0;
 rep(j,0,m)
 {
    cin>>p;
    vt[i].push_back(p);
    h[i][p]=1;
 }
}
int *f=new int[n];
rep(i,0,n)
f[i]=1;
int t;
rep(i,0,n)
{
    if(f[i])
    {
        t=0;
        rep(j,0,n)
        {
//            if(f[j]){
            t=0;
            if(i!=j){
            rep(k,0,vt[i].size())
            {
                if(h[j][vt[i][k]])
                    t++;
            }
            if(t==vt[i].size())
            {
                if(vt[j].size()>t)
                {
                    f[j]=0;
                }
                if(vt[i].size()==vt[j].size())
               {
                 f[i]=0;
               }
            }

            }
  //          }
        }
    }
}
rep(i,0,n)
{
    if(f[i])
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
return 0;
}


#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<cstring>
#include<set>
#include<utility>
#include<deque>
using namespace std;

#define mod 1000000007
#define rep(i,k,n) for(i=k;i<n;i++)
#define ip(a) freopen(a,"r",stdin)
#define out(b) freopen("b","w",stdout)

int main()
{
    ip("in.txt");
int n,m;
cin>>n;
int i;
int j,k,p;
vector<int>vt[n];
bool **h=new bool *[n];
rep(i,0,n)
{
 cin>>m;
 h[i]=new bool[101];
 rep(k,0,101)
   h[i][k]=0;
 rep(j,0,m)
 {
    cin>>p;
    vt[i].push_back(p);
    h[i][p]=1;
 }
}
int *f=new int[n];
rep(i,0,n)
f[i]=1;
//memset(f,1,sizeof(f));
int t;
rep(i,0,n)
{
    if(f[i])
    {
        t=0;
        rep(j,0,n)
        {
            if(f[j]){
            t=0;
            if(i!=j){
            rep(k,0,vt[i].size())
            {
                if(h[j][vt[i][k]])
                    t++;
               //     cout<<t<<endl;
            }
            if(t==vt[i].size())
            {
              //  cout<<t<<" "<<j<<" "<<vt[j].size()<<endl;
                if(vt[j].size()>t)
                {
                //    cout<<"ok";
                 //   cout<<j<<endl;
                    f[j]=0;
                }
            }
            }
            }
//            cout<<"ok";
        }
    }
}
rep(i,0,n)
{
    if(f[i])
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
return 0;
}


#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<cstring>
#include<set>
#include<utility>
#include<deque>
using namespace std;

#define mod 1000000007
#define rep(i,k,n) for(i=k;i<n;i++)
#define ip(a) freopen("a","r",stdin)
#define out(b) freopen("b","w",stdout)

int main()
{
int n,m;
cin>>n;
int i;
int j,k,p;
vector<int>vt[n];
bool **h=new bool *[n];
rep(i,0,n)
{
 cin>>m;
 h[i]=new bool[101];
 rep(k,0,101)
   h[i][k]=1;
 rep(j,0,m)
 {
    cin>>p;
    vt[i].push_back(p);
    h[i][p]=1;
 }
}
int *f=new int[n];
rep(i,0,n)
f[i]=1;
//memset(f,1,sizeof(f));
int t;
rep(i,0,n)
{
    if(f[i])
    {
        t=0;
        rep(j,i+1,n)
        {
            if(f[j]){
            rep(k,0,vt[i].size())
            {
                if(h[j][vt[i][k]])
                    t++;
            }
            if(t==vt[i].size())
            {
                if(vt[j].size()>=t)
                {
                 //   cout<<j<<endl;
                    f[j]=0;
                }
                if(vt[i].size()==vt[j].size())
                {
                    f[i]=0;
                    break;
                }
            }
            }
//            cout<<"ok";
        }
    }
}
rep(i,0,n)
{
    if(f[i])
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
return 0;
}


#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<cstring>
#include<set>
#include<utility>
#include<deque>
using namespace std;

#define mod 1000000007
#define rep(i,k,n) for(i=k;i<n;i++)
#define ip(a) freopen(a,"r",stdin)
#define out(b) freopen("b","w",stdout)

int main()
{
//    ip("in.txt");
int n,m;
cin>>n;
int i;
int j,k,p;
vector<int>vt[n];
bool **h=new bool *[n];
rep(i,0,n)
{
 cin>>m;
 h[i]=new bool[101];
 rep(k,0,101)
   h[i][k]=0;
 rep(j,0,m)
 {
    cin>>p;
    vt[i].push_back(p);
    h[i][p]=1;
 }
}
int *f=new int[n];
rep(i,0,n)
f[i]=1;
int t;
rep(i,0,n)
{
    if(f[i])
    {
        t=0;
        rep(j,0,n)
        {
            if(f[j]){
            t=0;
            if(i!=j){
            rep(k,0,vt[i].size())
            {
                if(h[j][vt[i][k]])
                    t++;
            }
            if(t==vt[i].size())
            {
                if(vt[j].size()>t)
                {
                    f[j]=0;
                }
            }
            }
            }
        }
    }
}
rep(i,0,n)
{
    if(f[i])
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
return 0;
}