N, M = list(map(int, input().split()))

X = [list(input().split()) for _ in range(M)]



acs = [False] * (N + 1)

was = [0] * (N + 1)



for p, s in X:

    if s == "AC":

        acs[int(p)] = True

    elif not acs[int(p)]:

        was[int(p)] += 1



was_cnt = 0

for a, w in zip(acs, was):

    if a:

        was_cnt += w



print((sum(acs), was_cnt))

N, M = list(map(int, input().split()))

X = []

for _ in range(M):

    p, s = input().split()

    X.append((int(p), s))



cnt = [[0, 0] for _ in range(N + 1)]

for p, s in X:

    if s == "AC":

        cnt[p][0] = 1

    elif cnt[p][0] == 0:

        cnt[p][1] += 1



ac = sum(v for v, _ in cnt)

wa = 0

for i in range(N + 1):

    if cnt[i][0] == 1:

        wa += cnt[i][1]

print((ac, wa))

N, M = list(map(int, input().split()))
X = [list(input().split()) for _ in range(M)]
acs = [False] * (N + 1)
was = [0] * (N + 1)
for p, s in X:
    if s == "AC":
        acs[int(p)] = True
    elif not acs[int(p)]:
        was[int(p)] += 1
was_cnt = 0
for a, w in zip(acs, was):
    if a:
        was_cnt += w
print((sum(acs), was_cnt))

N, M = list(map(int, input().split()))
X = []
for _ in range(M):
    p, s = input().split()
    X.append((int(p), s))
cnt = [[0, 0] for _ in range(N + 1)]
for p, s in X:
    if s == "AC":
        cnt[p][0] = 1
    elif cnt[p][0] == 0:
        cnt[p][1] += 1
ac = sum(v for v, _ in cnt)
wa = 0
for i in range(N + 1):
    if cnt[i][0] == 1:
        wa += cnt[i][1]
print((ac, wa))

-X = [list(input().split()) for _ in range(M)] -acs = [False] * (N + 1) -was = [0] * (N + 1) +X = [] +for _ in range(M): +    p, s = input().split() +    X.append((int(p), s)) +cnt = [[0, 0] for _ in range(N + 1)] -        acs[int(p)] = True -    elif not acs[int(p)]: -        was[int(p)] += 1 -was_cnt = 0 -for a, w in zip(acs, was): -    if a: -        was_cnt += w -print((sum(acs), was_cnt)) +        cnt[p][0] = 1 +    elif cnt[p][0] == 0: +        cnt[p][1] += 1 +ac = sum(v for v, _ in cnt) +wa = 0 +for i in range(N + 1): +    if cnt[i][0] == 1: +        wa += cnt[i][1] +print((ac, wa))