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

lst = []

AC_list = [False] * N

WA_cnt_list = [0] * N

for _ in range(M):

    r , judge = input().split()

    question_num = int(r) - 1

    if AC_list[question_num]:

        continue

    elif judge == "WA":

        WA_cnt_list[question_num] += 1

    elif judge == "AC":

        AC_list[question_num] = True

wa_cnt = 0

for i in range(N):

    if AC_list[i]:

        wa_cnt += WA_cnt_list[i]

print((sum(AC_list) , wa_cnt))

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

AC_flags = [False] * N

WA_counter = [0] * N

for _ in range(M):

    p, s = input().split()

    p = int(p) - 1

    if AC_flags[p]:

        continue

    elif s == 'WA':

        WA_counter[p] += 1

    else:

        AC_flags[p] = True

penalty = 0

for i in range(N):

    penalty += AC_flags[i] * WA_counter[i]

print((sum(AC_flags), penalty))



N, M = list(map(int, input().split()))
lst = []
AC_list = [False] * N
WA_cnt_list = [0] * N
for _ in range(M):
    r, judge = input().split()
    question_num = int(r) - 1
    if AC_list[question_num]:
        continue
    elif judge == "WA":
        WA_cnt_list[question_num] += 1
    elif judge == "AC":
        AC_list[question_num] = True
wa_cnt = 0
for i in range(N):
    if AC_list[i]:
        wa_cnt += WA_cnt_list[i]
print((sum(AC_list), wa_cnt))

N, M = list(map(int, input().split()))
AC_flags = [False] * N
WA_counter = [0] * N
for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    if AC_flags[p]:
        continue
    elif s == "WA":
        WA_counter[p] += 1
    else:
        AC_flags[p] = True
penalty = 0
for i in range(N):
    penalty += AC_flags[i] * WA_counter[i]
print((sum(AC_flags), penalty))

-lst = [] -AC_list = [False] * N -WA_cnt_list = [0] * N +AC_flags = [False] * N +WA_counter = [0] * N -    r, judge = input().split() -    question_num = int(r) - 1 -    if AC_list[question_num]: +    p, s = input().split() +    p = int(p) - 1 +    if AC_flags[p]: -    elif judge == "WA": -        WA_cnt_list[question_num] += 1 -    elif judge == "AC": -        AC_list[question_num] = True -wa_cnt = 0 +    elif s == "WA": +        WA_counter[p] += 1 +    else: +        AC_flags[p] = True +penalty = 0 -    if AC_list[i]: -        wa_cnt += WA_cnt_list[i] -print((sum(AC_list), wa_cnt)) +    penalty += AC_flags[i] * WA_counter[i] +print((sum(AC_flags), penalty))