n = int(input()) line = [[] for _ in range(1000)] for _ in range(n): l = list(input().split()) p = int(l[0]) for j in range(p): line[j].append(int(l[j+1])) ret = [] i = 0 while True: if not line[i]: break else: for c in line[i]: ret.append(c) i += 1 print(*ret)