N = int(input())
G0, G1, G2, G3 = 0, 0, 0, 0
for i in range(N):
    Si = input()
    if Si == 'AG':
        G0 += 1
 
    elif Si == 'WA':
        G1  += 1
 
    elif Si == 'TLE':
        G2 += 1
 
    else:
        G3 += 1
 
print('AG x ' + str(G0))
print('WA x ' + str(G1))
print('TLE x ' + str(G2))
print('RE x ' + str(G3))