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



AC = [False] * (N+1)

WA_cnt = [0] * (N+1)



penal = 0

for _ in range(M):

    p,s = list(map(str,input().split()))

    p = int(p)

    if AC[p]:

        continue

    if s == "WA":

        WA_cnt[p] += 1

    else:

        AC[p] = True

        penal += WA_cnt[p]



ac = sum(AC)

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

pS = [[i for i in input().split()] for _ in range(M)]



# True -> AC済み

AC = [False] * N

WA_cnt = [0] * N



pena = 0

for p,S in pS:

    p = int(p) - 1



    if AC[p]:

        continue



    if S == "WA":

        WA_cnt[p] += 1

    else:

        AC[p] = True

        pena += WA_cnt[p]

    

ac = sum(AC)

print((ac,pena))
N, M = list(map(int, input().split()))
AC = [False] * (N + 1)
WA_cnt = [0] * (N + 1)
penal = 0
for _ in range(M):
    p, s = list(map(str, input().split()))
    p = int(p)
    if AC[p]:
        continue
    if s == "WA":
        WA_cnt[p] += 1
    else:
        AC[p] = True
        penal += WA_cnt[p]
ac = sum(AC)
print((ac, penal))

N, M = list(map(int, input().split()))
pS = [[i for i in input().split()] for _ in range(M)]
# True -> AC済み
AC = [False] * N
WA_cnt = [0] * N
pena = 0
for p, S in pS:
    p = int(p) - 1
    if AC[p]:
        continue
    if S == "WA":
        WA_cnt[p] += 1
    else:
        AC[p] = True
        pena += WA_cnt[p]
ac = sum(AC)
print((ac, pena))

-AC = [False] * (N + 1) -WA_cnt = [0] * (N + 1) -penal = 0 -for _ in range(M): -    p, s = list(map(str, input().split())) -    p = int(p) +pS = [[i for i in input().split()] for _ in range(M)] +# True -> AC済み +AC = [False] * N +WA_cnt = [0] * N +pena = 0 +for p, S in pS: +    p = int(p) - 1 -    if s == "WA": +    if S == "WA": -        penal += WA_cnt[p] +        pena += WA_cnt[p] -print((ac, penal)) +print((ac, pena))