n, m = list(map(int, input().split()))

l = [tuple(input().split()) for _ in range(m)]

subs = [[] for _ in range(n)]



for i in range(m):

    subs[int(l[i][0])-1].append(l[i][1])



ac, p = 0, 0



for j in range(n):

    if 'AC' in subs[j]:

        ac += 1

        for k in range(len(subs[j])):

                if subs[j][k] == 'WA':

                    p += 1

                else:

                    break



print((ac, p))
n, m = list(map(int, input().split()))



rslts = [[] for _ in range(n)]

for i in range(m):

    x, y = input().split()

    rslts[int(x) - 1].append(y)

#print(rslts)



ac, p = 0, 0

for j in range(n):

    seq = rslts[j]

    if 'AC' in seq:

        ac += 1

        for k in seq:

            if k == 'WA':

                p += 1

            else:

                break



print((ac, p))
n, m = list(map(int, input().split()))
l = [tuple(input().split()) for _ in range(m)]
subs = [[] for _ in range(n)]
for i in range(m):
    subs[int(l[i][0]) - 1].append(l[i][1])
ac, p = 0, 0
for j in range(n):
    if "AC" in subs[j]:
        ac += 1
        for k in range(len(subs[j])):
            if subs[j][k] == "WA":
                p += 1
            else:
                break
print((ac, p))

n, m = list(map(int, input().split()))
rslts = [[] for _ in range(n)]
for i in range(m):
    x, y = input().split()
    rslts[int(x) - 1].append(y)
# print(rslts)
ac, p = 0, 0
for j in range(n):
    seq = rslts[j]
    if "AC" in seq:
        ac += 1
        for k in seq:
            if k == "WA":
                p += 1
            else:
                break
print((ac, p))

-l = [tuple(input().split()) for _ in range(m)] -subs = [[] for _ in range(n)] +rslts = [[] for _ in range(n)] -    subs[int(l[i][0]) - 1].append(l[i][1]) +    x, y = input().split() +    rslts[int(x) - 1].append(y) +# print(rslts) -    if "AC" in subs[j]: +    seq = rslts[j] +    if "AC" in seq: -        for k in range(len(subs[j])): -            if subs[j][k] == "WA": +        for k in seq: +            if k == "WA":