number = gets.chomp.to_i
answer_arr = [0,0,0,0]
number.times do
  rank = gets.chomp
  if rank == 'AC'
    answer_arr[0] += 1
  elsif rank == 'WA'
    answer_arr[1] += 1
  elsif rank == 'TLE'
    answer_arr[2] += 1
  elsif rank == 'RE'
    answer_arr[3] += 1
  end
end

puts "AC x #{answer_arr[0]}"
puts "WA x #{answer_arr[1]}"
puts "TLE x #{answer_arr[2]}"
puts "RE x #{answer_arr[3]}"