n = gets.to_i
counter = [0,0,0,0]
while n > 0
  s = gets.chomp.to_s
  case s
  when "AC"
    counter[0] += 1
  when "WA"
    counter[1] += 1
  when "TLE"
    counter[2] += 1
  else
    counter[3] += 1
  end
n -= 1
end
puts "AC x " + counter[0].to_s
puts "WA x " + counter[1].to_s
puts "TLE x " + counter[2].to_s
puts "RE x " + counter[3].to_s
