from collections import Counter

N=int(eval(input()))

S=[eval(input()) for i in range(N)]

a=[0]*4

for i in range(N):

    if S[i]=='AC':

        a[0]+=1

    elif S[i]=='WA':

        a[1]+=1

    elif S[i]=='TLE':

        a[2]+=1

    else:

        a[3]+=1

print(('AC','x',a[0]))

print(('WA','x',a[1]))

print(('TLE','x',a[2]))

print(('RE','x',a[3]))
N=int(eval(input()))

S=[eval(input()) for i in range(N)]

print(('AC','x',S.count('AC')))

print(('WA','x',S.count('WA')))

print(('TLE','x',S.count('TLE')))

print(('RE','x',S.count('RE')))
from collections import Counter

N = int(eval(input()))
S = [eval(input()) for i in range(N)]
a = [0] * 4
for i in range(N):
    if S[i] == "AC":
        a[0] += 1
    elif S[i] == "WA":
        a[1] += 1
    elif S[i] == "TLE":
        a[2] += 1
    else:
        a[3] += 1
print(("AC", "x", a[0]))
print(("WA", "x", a[1]))
print(("TLE", "x", a[2]))
print(("RE", "x", a[3]))

N = int(eval(input()))
S = [eval(input()) for i in range(N)]
print(("AC", "x", S.count("AC")))
print(("WA", "x", S.count("WA")))
print(("TLE", "x", S.count("TLE")))
print(("RE", "x", S.count("RE")))

-from collections import Counter - -a = [0] * 4 -for i in range(N): -    if S[i] == "AC": -        a[0] += 1 -    elif S[i] == "WA": -        a[1] += 1 -    elif S[i] == "TLE": -        a[2] += 1 -    else: -        a[3] += 1 -print(("AC", "x", a[0])) -print(("WA", "x", a[1])) -print(("TLE", "x", a[2])) -print(("RE", "x", a[3])) +print(("AC", "x", S.count("AC"))) +print(("WA", "x", S.count("WA"))) +print(("TLE", "x", S.count("TLE"))) +print(("RE", "x", S.count("RE")))