n=int(input())
c1=c2=c3=c4=0
for i in range(n):
 x=input()
 if x=="AC":
  c1+=1
 elif x=="WA":
  c2+=1
 elif x=="TLE":
  c3+=1
 elif x=="RE":
  c4+=1
print("AC*"+str(c1))
print("WA*"+str(c2))
print("TLE*"+str(c3))
print("RE*"+str(c4))