n = int(eval(input()))

ac = 0

wa = 0

tle = 0

re = 0

for i in range(n):

  s = eval(input())

  if s == 'AC':

    ac += 1

  elif s == 'WA':

    wa += 1

  elif s== 'TLE':

    tle += 1

  elif s== 'RE':

    re += 1

print(('AC x '+str(ac))) 

print(('WA x '+str(wa))) 

print(('TLE x '+str(tle))) 

print(('RE x '+str(re))) 
n=int(eval(input()))

s=[eval(input())for _ 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")))

n = int(eval(input()))
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    s = eval(input())
    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    elif s == "RE":
        re += 1
print(("AC x " + str(ac)))
print(("WA x " + str(wa)))
print(("TLE x " + str(tle)))
print(("RE x " + str(re)))

n = int(eval(input()))
s = [eval(input()) for _ 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")))

-ac = 0 -wa = 0 -tle = 0 -re = 0 -for i in range(n): -    s = eval(input()) -    if s == "AC": -        ac += 1 -    elif s == "WA": -        wa += 1 -    elif s == "TLE": -        tle += 1 -    elif s == "RE": -        re += 1 -print(("AC x " + str(ac))) -print(("WA x " + str(wa))) -print(("TLE x " + str(tle))) -print(("RE x " + str(re))) +s = [eval(input()) for _ 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")))