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

AC = (N+1)*[0]

WA = (N+1)*[0]

wa=0



for m in range(M):

  p,s = input().split()

  p = int(p)

  

  if AC[p]==0 and s=="AC":

  	AC[p]=1

  	wa+=WA[p]

    

  WA[p]+=1



print((sum(AC),wa)) 
N,M = list(map(int,input().split()))

AC = N*[0]

WA = N*[0]



for m in range(M):

  P,S = input().split()

  P = int(P)-1

  

  if AC[P]==1:

    continue

  if S=="WA":

    WA[P]+=1

  else:

    AC[P]=1



wa = 0 

for a,w in zip(AC,WA):

  wa+=w*a



print((sum(AC),wa))
N, M = list(map(int, input().split()))
AC = (N + 1) * [0]
WA = (N + 1) * [0]
wa = 0
for m in range(M):
    p, s = input().split()
    p = int(p)
    if AC[p] == 0 and s == "AC":
        AC[p] = 1
        wa += WA[p]
    WA[p] += 1
print((sum(AC), wa))

N, M = list(map(int, input().split()))
AC = N * [0]
WA = N * [0]
for m in range(M):
    P, S = input().split()
    P = int(P) - 1
    if AC[P] == 1:
        continue
    if S == "WA":
        WA[P] += 1
    else:
        AC[P] = 1
wa = 0
for a, w in zip(AC, WA):
    wa += w * a
print((sum(AC), wa))

-AC = (N + 1) * [0] -WA = (N + 1) * [0] +AC = N * [0] +WA = N * [0] +for m in range(M): +    P, S = input().split() +    P = int(P) - 1 +    if AC[P] == 1: +        continue +    if S == "WA": +        WA[P] += 1 +    else: +        AC[P] = 1 -for m in range(M): -    p, s = input().split() -    p = int(p) -    if AC[p] == 0 and s == "AC": -        AC[p] = 1 -        wa += WA[p] -    WA[p] += 1 +for a, w in zip(AC, WA): +    wa += w * a