N = int(input()) P = [] A = [] for n in range(N): p, *a = map(int, input().split()) P += [p] A += [[*a]] ans = [] for i in range(100): for j in range(N): if i+1 <= P[j]: ans += [A[j][i]] print(ans)