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

C = {i:[0,0] for i in range(1,N+1)}

for _ in range(M):

    p,S = input().split()

    p = int(p)

    if C[p][0]==0 and S=="WA":

        C[p][1] += 1

    elif C[p][0]==0 and S=="AC":

        C[p][0] = 1

numA = 0

numB = 0

for i in range(1,N+1):

    numA += C[i][0]

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

        numB += C[i][1]

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

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

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

for _ in range(M):

    p,S = input().split()

    p = int(p)

    if S=="AC":

        if A[p]==0:

            A[p]=1

    else:

        if A[p]==0:

            B[p] += 1

for i in range(N+1):

    if A[i]==0:

        B[i]=0

print((sum(A),sum(B)))
N, M = list(map(int, input().split()))
C = {i: [0, 0] for i in range(1, N + 1)}
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if C[p][0] == 0 and S == "WA":
        C[p][1] += 1
    elif C[p][0] == 0 and S == "AC":
        C[p][0] = 1
numA = 0
numB = 0
for i in range(1, N + 1):
    numA += C[i][0]
    if C[i][0] == 1:
        numB += C[i][1]
print((numA, numB))

N, M = list(map(int, input().split()))
A = [0 for _ in range(N + 1)]
B = [0 for _ in range(N + 1)]
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S == "AC":
        if A[p] == 0:
            A[p] = 1
    else:
        if A[p] == 0:
            B[p] += 1
for i in range(N + 1):
    if A[i] == 0:
        B[i] = 0
print((sum(A), sum(B)))

-C = {i: [0, 0] for i in range(1, N + 1)} +A = [0 for _ in range(N + 1)] +B = [0 for _ in range(N + 1)] -    if C[p][0] == 0 and S == "WA": -        C[p][1] += 1 -    elif C[p][0] == 0 and S == "AC": -        C[p][0] = 1 -numA = 0 -numB = 0 -for i in range(1, N + 1): -    numA += C[i][0] -    if C[i][0] == 1: -        numB += C[i][1] -print((numA, numB)) +    if S == "AC": +        if A[p] == 0: +            A[p] = 1 +    else: +        if A[p] == 0: +            B[p] += 1 +for i in range(N + 1): +    if A[i] == 0: +        B[i] = 0 +print((sum(A), sum(B)))