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



submission = []

for i in range(n):

    submission.append([])



for i in range(m):

    pi, si = input().split()

    submission[int(pi) - 1].append(si)

    

n_ac = 0

n_penalty = 0

for i in range(n):

    if "AC" in submission[i]:

        n_ac += 1

        ac_index = submission[i].index('AC')

        n_penalty += ac_index

print((n_ac, n_penalty))
n, m = map(int, input().split())

s = [[] for i in range(n)]

for i in range(m):

    p, S = input().split()

    s[int(p) - 1] += [S]

print(sum('AC' in si for si in s), end=' ')

print(sum(si[:si.index('AC')].count('WA') if 'AC' in si else 0 for si in s))

n, m = list(map(int, input().split()))
submission = []
for i in range(n):
    submission.append([])
for i in range(m):
    pi, si = input().split()
    submission[int(pi) - 1].append(si)
n_ac = 0
n_penalty = 0
for i in range(n):
    if "AC" in submission[i]:
        n_ac += 1
        ac_index = submission[i].index("AC")
        n_penalty += ac_index
print((n_ac, n_penalty))

n, m = map(int, input().split())
s = [[] for i in range(n)]
for i in range(m):
    p, S = input().split()
    s[int(p) - 1] += [S]
print(sum("AC" in si for si in s), end=" ")
print(sum(si[: si.index("AC")].count("WA") if "AC" in si else 0 for si in s))

-n, m = list(map(int, input().split())) -submission = [] -for i in range(n): -    submission.append([]) +n, m = map(int, input().split()) +s = [[] for i in range(n)] -    pi, si = input().split() -    submission[int(pi) - 1].append(si) -n_ac = 0 -n_penalty = 0 -for i in range(n): -    if "AC" in submission[i]: -        n_ac += 1 -        ac_index = submission[i].index("AC") -        n_penalty += ac_index -print((n_ac, n_penalty)) +    p, S = input().split() +    s[int(p) - 1] += [S] +print(sum("AC" in si for si in s), end=" ") +print(sum(si[: si.index("AC")].count("WA") if "AC" in si else 0 for si in s))