t = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for i in range(t):
    s = str(input())
    if s == 'AC':
        c0 += 1
    elif s == 'WA':
        c1 += 1
    elif s == 'TLE':
        c2 += 1
    elif s == 'RE':
        c3 += 1
print('AC X ' + str(c0))
print('WA X ' + str(c1))
print('TLE X ' + str(c2))
print('RE X ' + str(c3))