N = gets.chomp.to_i
S = N.times.map{gets.chomp.to_s}

countac = 0
countwa = 0
counttle = 0
countre = 0

(0...N).each do |i|
  if S[i] == "AC"
    countac += 1
  elsif S[i] == "WA"
    countwa += 1
  elsif S[i] == "TLE"
    counttle += 1
  elsif S[i] == "RE"
    countre += 1
  end
end

puts "AC x #{countac}"
puts "WA x #{countwa}"
puts "TLE x #{counttle}"
puts "RE x #{countre}"