t = int(input())
wlist = [0]*4
for i in range(t):
  w = input()
  if w == "AC":
    wlist[0] += 1
  elif w = "WA":
   	wlist[1] += 1
  elif w = "TEL":
    wlist[2] += 1
  else:
    wlist[3] += 1
print("AC x " + wlist[0])
print("WA x " + wlist[1])
print("TEL x " + wlist[2])
print("RE x " + wlist[3])  