n = gets.to_i
s = n.times.map{ gets.chop }.group_by{ _1 }
puts "AC x #{s['AC'] ? s['AC'].count : 0}"
puts "WA x #{s['WA'] ? s['WA'].count : 0}"
puts "TLE x #{s['TLE'] ? s['TLE'].count : 0}"
puts "RE x #{s['RE'] ? s['RE'].count : 0}"