n = gets.to_i
ans = Array.new(4,0)
n.times do
  a = gets.chomp
  case a
  when "AC"
    ans[0] += 1
  when "WA"
    ans[1] += 1
  when "TLE"
    ans[2] += 1
  when "RE"
    ans[3] += 1
  end
end
puts "AC x #{ans[0]}"
puts "WA x #{ans[1]}"
puts "TLE x #{ans[2]}"
puts "RE x #{ans[3]}"