n = gets.to_i
arr = []
n.times{arr << gets.chomp.split.map(&:to_i)}
uniq = [[],[],[]]
arr.transpose.each_with_index{|ar, i|
    h = Hash.new(0)
    ar.each{|x| h[x]+=1}
    h.each{|k, v| uniq[i] << k if v == 1}
}
score = Array.new(n, 0)
arr.each_with_index{|ar, player|
    ar.each_with_index{|x, i|
    score[player] += x if uniq[i].include?(x)}
}
puts score
