N = int(input())

score = [list(map(int, input().split())) for _ in range(N)]

players = [0 for _ in range(N)]

for play in list(zip(*score)):

    for i, p in enumerate(play):

        if play.count(p) == 1:

            players[i] += p

print(*players, sep='\n')

N = int(input())

score = [input().split() for _ in range(N)]

players = [0]*N

for play in list(zip(*score)):

    for i, p in enumerate(play):

        if play.count(p) == 1:

            players[i] += int(p)

print(*players, sep='\n')

N = int(input())
score = [list(map(int, input().split())) for _ in range(N)]
players = [0 for _ in range(N)]
for play in list(zip(*score)):
    for i, p in enumerate(play):
        if play.count(p) == 1:
            players[i] += p
print(*players, sep="\n")

N = int(input())
score = [input().split() for _ in range(N)]
players = [0] * N
for play in list(zip(*score)):
    for i, p in enumerate(play):
        if play.count(p) == 1:
            players[i] += int(p)
print(*players, sep="\n")

-score = [list(map(int, input().split())) for _ in range(N)] -players = [0 for _ in range(N)] +score = [input().split() for _ in range(N)] +players = [0] * N -            players[i] += p +            players[i] += int(p)