n = int(input())



t = ['AC', 'WA', 'TLE', 'RE']

d = {}

for _ in range(n):

    s = input()

    d[s] = d.get(s, 0) + 1

for k in t:

    print('%s x %d' % (k, d.get(k, 0)))
verdict = eval(input())

list1 = []

list2 = ["AC", "WA", "TLE", "RE"]



for i in range(0, int(verdict)):

    x = eval(input())

    list1.append(x)



for x in list2:

    print(f"{x} x {list1.count(x)}")

n = int(input())
t = ["AC", "WA", "TLE", "RE"]
d = {}
for _ in range(n):
    s = input()
    d[s] = d.get(s, 0) + 1
for k in t:
    print("%s x %d" % (k, d.get(k, 0)))

verdict = eval(input())
list1 = []
list2 = ["AC", "WA", "TLE", "RE"]
for i in range(0, int(verdict)):
    x = eval(input())
    list1.append(x)
for x in list2:
    print(f"{x} x {list1.count(x)}")

-n = int(input()) -t = ["AC", "WA", "TLE", "RE"] -d = {} -for _ in range(n): -    s = input() -    d[s] = d.get(s, 0) + 1 -for k in t: -    print("%s x %d" % (k, d.get(k, 0))) +verdict = eval(input()) +list1 = [] +list2 = ["AC", "WA", "TLE", "RE"] +for i in range(0, int(verdict)): +    x = eval(input()) +    list1.append(x) +for x in list2: +    print(f"{x} x {list1.count(x)}")