#include <bits/stdc++.h>
using namespace std;
int SD() {
  int i;
  scanf("%d", &i);
  return i;
}
long long SLL() {
  long long i;
  scanf("%lld", &i);
  return i;
}
char SC() {
  char i;
  scanf("%c", &i);
  return i;
}
const int AKA = 1e6 + 6;
int fr[AKA];
vector<int> v;
int main() {
  int ACCEPTED = 1;
  while (ACCEPTED--) {
    int n = SD(), a = INT_MIN, idx = -1;
    while (n--) {
      int k = SD();
      for (int i = 0; i < k; ++i) ++fr[SD()];
    }
    for (int i = 1; i <= 100; ++i)
      if (fr[i] > a) a = fr[i], idx = i;
    v.push_back(idx);
    for (int i = 1; i <= 100; ++i)
      if (fr[i] == a && i != idx) v.push_back(i);
    for (auto x : v) printf("%d ", x);
  }
}
