local read = io.read

local N = read("*n")
read("*l")

local str_s_result = {"AC", "WA", "TLE", "RE"}
local results = {0, 0, 0, 0}

for i = 1, N do
	local S_i = read("*l")
	for j = 1, #str_s_result do
		if S_i == str_s_result[j] then
			results[j] = results[j] + 1
		end
	end
end

for i = 1, #results do
	print(str_s_result[i].." x "..results[i])
end
