#include <iostream>
#include <vector>
using namespace std;
const int MN = 5e5+100;
/*
struct Node {
int ma = 0;
Node * left;
Node * right;
Node(int v) {
sum = v;
}
}
Node * t[MN];
int ma(Node * a) {
if(a == NULL) return 0;
return a->ma;
}
int setValue(Node*& k, int l, int r, int x) {
if(l > x || r < x) {
return ma(k);
}
if(l == r) {
Node * n2 = new Node(1);
k = n2;
return ma(k);
}
if(k == NULL) {
k = new Node(0);
}
int mid = (l+r)/2;
int q = setValue(k->left, l, mid, x);
int w = setValue(k->right, mid+1, r, x);
k->ma = max(q, w);
}
int lol = 0;
int find(Node* kb, Node *ke, int l, int r) {
if(k2 == NULL) {
return 0;
}
if(sum(k) == (r-l+1)) {
lol = max(lol, r+1);
return 1;
}
if(k == NULL) {
return 0;
}
int mid = (l+r)/2;
if(find(k->left, l, mid)) {
find(k->right, mid+1, r);
}
return 0;
}
*/
const int N = 1<<19;
int st[2*N];
vector<int> t[MN];
int getMin(int a, int b) {
a += N;
b += N;
int mi = 1e9;
for(; a <= b; a/=2, b/=2) {
if(a&1) mi = min(mi, st[a++]);
if(~b&1) mi = min(mi, st[b--]);
}
return mi;
}
void setValue(int a, int v) {
a += N;
st[a] = v;
for(a/=2; a; a/=2) {
st[a] = min(st[a*2], st[a*2+1]);
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
cout<<1<<' ';
for(int i = 0; i < n; ++i) {
int c;
cin>>c;
for(int j = 0; j < c; ++j) {
int x;
cin>>x;
--x;
t[x].push_back(i);
}
}
memset(st, -1, sizeof st);
setValue(0, 1e9);
for(int i = 1; i < n; ++i) {
if(t[i].size() == 0) {
setValue(1, i);
cout<<1<<' ';
}
else {
int ma = 1;
for(int x: t[i]) {
int b = x+1;
int lo = 0;
int hi = n;
int best = 0;
while(lo <= hi) {
int mid = (lo+hi)/2;
if(getMin(0, mid) >= b) {
best = mid;
lo = mid+1;
}
else {
hi = mid-1;
}
}
ma = max(ma, best+1);
}
cout<<ma<<' ';
setValue(ma, i);
}
}
cout<<endl;
}