N = gets.to_i
S = readlines.map(&:to_s)
numAC,numWA,numTLE,numRE = 0

S.each do |c|
	case c
	when 'AC'
		numAC += 1
	when 'WA'
		numWA += 1
	when 'TLE'
		numTLE += 1
	when 'RE'
		numRE += 1
	end
end

puts "AC x #{numAC}\n"
puts "WA x #{numWA}\n"
puts "TLE x #{numTLE}\n"
puts "RE x #{numRE}\n"