N=int(input())
ac=0
wa=0
tre=0
re=0
for i in range(N):
  str=input()
  if str=="AC":
    ac=ac+1
  elif str=="WA":
    wa=wa+1
  elif str=="TRE":
    tre=tre+1
  else:
    re=re+1
print("AC x ", ac)
print("WA x ", wa)
print("TRE x ", tre)
print("RE x ", re) 
