n = int(input()) a = [] for _ in range(n): a += [list(map(int, input().split()))] res = [] for j in range(1, 100): for i in range(n): if len(a[i]) <= j: continue res += [a[i][j]] print(*res)