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



lac = [0] * n

lwa = [0] * n



for i in range(m):

    p, s = input().split()

    p = int(p) - 1

    if lac[p] == 0:

        if s == 'WA':

            lwa[p] += 1

        if s == 'AC':

            lac[p] = 1



lwa = [x * y for x, y in zip(lac, lwa)]

print((sum(lac), sum(lwa)))
n, m = list(map(int, input().split()))



lac = set()

lwa = [0] * n

ac = 0

wa = 0



for i in range(m):

    p, s = input().split()

    p = int(p) - 1

    if p in lac:

        continue

    if s == 'AC':

        lac.add(p)

        ac += 1

        wa += lwa[p]

    if s == 'WA':

        lwa[p] += 1



print((ac, wa))
n, m = list(map(int, input().split()))
lac = [0] * n
lwa = [0] * n
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if lac[p] == 0:
        if s == "WA":
            lwa[p] += 1
        if s == "AC":
            lac[p] = 1
lwa = [x * y for x, y in zip(lac, lwa)]
print((sum(lac), sum(lwa)))

n, m = list(map(int, input().split()))
lac = set()
lwa = [0] * n
ac = 0
wa = 0
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if p in lac:
        continue
    if s == "AC":
        lac.add(p)
        ac += 1
        wa += lwa[p]
    if s == "WA":
        lwa[p] += 1
print((ac, wa))

-lac = [0] * n +lac = set() +ac = 0 +wa = 0 -    if lac[p] == 0: -        if s == "WA": -            lwa[p] += 1 -        if s == "AC": -            lac[p] = 1 -lwa = [x * y for x, y in zip(lac, lwa)] -print((sum(lac), sum(lwa))) +    if p in lac: +        continue +    if s == "AC": +        lac.add(p) +        ac += 1 +        wa += lwa[p] +    if s == "WA": +        lwa[p] += 1 +print((ac, wa))