#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
vector<int> a[maxn];
bool flag[maxn];
int ans[maxn];
int n;
bool judge(int x, int y) {
  int cnt = 0;
  memset(flag, false, sizeof(flag));
  for (int i = 0; i < (int)a[x].size(); i++) {
    flag[a[x][i]] = true;
  }
  for (int i = 0; i < (int)a[y].size(); i++) {
    if (flag[a[y][i]] == false) return false;
  }
  return true;
}
int main() {
  while (cin >> n) {
    for (int i = 1; i <= n; i++) a[i].clear();
    for (int i = 1; i <= n; i++) {
      int m;
      cin >> m;
      while (m--) {
        int x;
        cin >> x;
        a[i].push_back(x);
      }
    }
    for (int i = 1; i <= n; i++) ans[i] = 1;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (i == j) continue;
        if (judge(i, j)) {
          ans[i] = 0;
          break;
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      if (ans[i])
        puts("YES");
      else
        puts("NO");
    }
  }
  return 0;
}
