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

P = [0]*n

AC = [False]*n

correct = 0

penalty = 0

for i in range(m):

  ans = input().split()

  problem = int(ans[0])

  result = ans[1]

  if AC[problem-1] == False:

    if result == 'AC':

      AC[problem-1] = True

      correct += 1

      penalty += P[problem-1]

    else:

      P[problem-1] += 1

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

Penalty = [0]*(n+1)

AC = [False]*(n+1)

correct = 0

penalty = 0

for i in range(m):

  ans = input().split()

  problem = int(ans[0])

  result = ans[1]

  if AC[problem] == False:

    if result == 'AC':

      AC[problem] = True

      correct += 1

      penalty += Penalty[problem]

    else:

      Penalty[problem] += 1

print((correct, penalty))
n, m = list(map(int, input().split()))
P = [0] * n
AC = [False] * n
correct = 0
penalty = 0
for i in range(m):
    ans = input().split()
    problem = int(ans[0])
    result = ans[1]
    if AC[problem - 1] == False:
        if result == "AC":
            AC[problem - 1] = True
            correct += 1
            penalty += P[problem - 1]
        else:
            P[problem - 1] += 1
print((correct, penalty))

n, m = list(map(int, input().split()))
Penalty = [0] * (n + 1)
AC = [False] * (n + 1)
correct = 0
penalty = 0
for i in range(m):
    ans = input().split()
    problem = int(ans[0])
    result = ans[1]
    if AC[problem] == False:
        if result == "AC":
            AC[problem] = True
            correct += 1
            penalty += Penalty[problem]
        else:
            Penalty[problem] += 1
print((correct, penalty))

-P = [0] * n -AC = [False] * n +Penalty = [0] * (n + 1) +AC = [False] * (n + 1) -    if AC[problem - 1] == False: +    if AC[problem] == False: -            AC[problem - 1] = True +            AC[problem] = True -            penalty += P[problem - 1] +            penalty += Penalty[problem] -            P[problem - 1] += 1 +            Penalty[problem] += 1