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

pena_list = [[0, 0] for i in range(n)]

ac = 0

wa = 0

teishutu = []



for i in range(m):

    p, s = input().split()

    p = int(p)

    if s == 'AC' and pena_list[p-1][0] == 0:

        ac += 1

        wa += pena_list[p-1][1]

        pena_list[p-1][0] = 1

    elif s == 'WA':

        pena_list[p-1][1] += 1



print((ac, wa))

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

ac_list = [0 for i in range(n+1)]

wa_list = [0 for i in range(n+1)]

p_list = []

ac = 0

pena = 0



for i in range(m):

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

    p = int(p)

    if s == 'AC' and ac_list[p-1] != 1:

        ac += 1

        ac_list[p-1] = 1

        pena += wa_list[p-1]

    elif s == 'WA' and ac_list[p-1] != 1:

        wa_list[p-1] += 1



print((ac, pena))

n, m = list(map(int, input().split()))
pena_list = [[0, 0] for i in range(n)]
ac = 0
wa = 0
teishutu = []
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC" and pena_list[p - 1][0] == 0:
        ac += 1
        wa += pena_list[p - 1][1]
        pena_list[p - 1][0] = 1
    elif s == "WA":
        pena_list[p - 1][1] += 1
print((ac, wa))

n, m = list(map(int, input().split()))
ac_list = [0 for i in range(n + 1)]
wa_list = [0 for i in range(n + 1)]
p_list = []
ac = 0
pena = 0
for i in range(m):
    p, s = list(map(str, input().split()))
    p = int(p)
    if s == "AC" and ac_list[p - 1] != 1:
        ac += 1
        ac_list[p - 1] = 1
        pena += wa_list[p - 1]
    elif s == "WA" and ac_list[p - 1] != 1:
        wa_list[p - 1] += 1
print((ac, pena))

-pena_list = [[0, 0] for i in range(n)] +ac_list = [0 for i in range(n + 1)] +wa_list = [0 for i in range(n + 1)] +p_list = [] -wa = 0 -teishutu = [] +pena = 0 -    p, s = input().split() +    p, s = list(map(str, input().split())) -    if s == "AC" and pena_list[p - 1][0] == 0: +    if s == "AC" and ac_list[p - 1] != 1: -        wa += pena_list[p - 1][1] -        pena_list[p - 1][0] = 1 -    elif s == "WA": -        pena_list[p - 1][1] += 1 -print((ac, wa)) +        ac_list[p - 1] = 1 +        pena += wa_list[p - 1] +    elif s == "WA" and ac_list[p - 1] != 1: +        wa_list[p - 1] += 1 +print((ac, pena))