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

ac=[0 for i in range (n)]

wa=[0 for i in range (n)]

grid = []

for i in range(m):

    a,b = input().split()

    if  ac[int(a)-1] == 1:

        continue

    if b == 'AC':

        ac[int(a)-1] = 1

    elif b == 'WA':

        wa[int(a)-1] += 1

ac_con,wa_con = 0,0

for i in range(n):

    if ac[i] == 0:

        continue

    else:

        ac_con+=1

        wa_con+=wa[i]

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

memo2 = [False for i in range(n)]

memo = [0 for i in range(n)]

count1,count2 = 0,0

for i in range(m):

    p,l = input().split()

    p = int(p)-1

    if memo2[p]:

        continue

    else:

        if l == 'WA':

            memo[p]+=1

        else:

            memo2[p] = True

            count2 += 1

            count1+=memo[p]

print((count2,count1))
n, m = list(map(int, input().split()))
ac = [0 for i in range(n)]
wa = [0 for i in range(n)]
grid = []
for i in range(m):
    a, b = input().split()
    if ac[int(a) - 1] == 1:
        continue
    if b == "AC":
        ac[int(a) - 1] = 1
    elif b == "WA":
        wa[int(a) - 1] += 1
ac_con, wa_con = 0, 0
for i in range(n):
    if ac[i] == 0:
        continue
    else:
        ac_con += 1
        wa_con += wa[i]
print((ac_con, wa_con))

n, m = list(map(int, input().split()))
memo2 = [False for i in range(n)]
memo = [0 for i in range(n)]
count1, count2 = 0, 0
for i in range(m):
    p, l = input().split()
    p = int(p) - 1
    if memo2[p]:
        continue
    else:
        if l == "WA":
            memo[p] += 1
        else:
            memo2[p] = True
            count2 += 1
            count1 += memo[p]
print((count2, count1))

-ac = [0 for i in range(n)] -wa = [0 for i in range(n)] -grid = [] +memo2 = [False for i in range(n)] +memo = [0 for i in range(n)] +count1, count2 = 0, 0 -    a, b = input().split() -    if ac[int(a) - 1] == 1: -        continue -    if b == "AC": -        ac[int(a) - 1] = 1 -    elif b == "WA": -        wa[int(a) - 1] += 1 -ac_con, wa_con = 0, 0 -for i in range(n): -    if ac[i] == 0: +    p, l = input().split() +    p = int(p) - 1 +    if memo2[p]: -        ac_con += 1 -        wa_con += wa[i] -print((ac_con, wa_con)) +        if l == "WA": +            memo[p] += 1 +        else: +            memo2[p] = True +            count2 += 1 +            count1 += memo[p] +print((count2, count1))