players = Array.new(gets.to_i, 0)
m = gets.to_i
targets = gets.split.map{|n| n.to_i - 1}

m.times do |i|
  target = targets[i]
  gets.split.map{|n| n.to_i - 1}.each_with_index{|guess, j|
    guess == target ? (players[j] += 1) : (players[target] += 1)
  }
end

puts players