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

l = [[0]*2 for _ in range(n + 1)]

ac = 0

wa = 0



for i in range(m):

    p, s = input().split()

    p = int(p)

    if l[p][0] == 0: #ACが0の場合

        if s == "AC":

            l[p][0] = 1

        else:

            l[p][1] += 1



for i in range(1, n + 1):

    ac += int(l[i][0])

    if int(l[i][0]) != 0:

        wa += int(l[i][1])

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

l = [0]*(n + 1)

ac = 0

wa = 0



for i in range(m):

    p, s = input().split()

    p = int(p)

    if l[p] == -1:

        continue

    if s == "AC":

        ac += 1

        wa += l[p]

        l[p] = -1

    else:

        l[p] += 1



print((ac, wa))
n, m = list(map(int, input().split()))
l = [[0] * 2 for _ in range(n + 1)]
ac = 0
wa = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if l[p][0] == 0:  # ACが0の場合
        if s == "AC":
            l[p][0] = 1
        else:
            l[p][1] += 1
for i in range(1, n + 1):
    ac += int(l[i][0])
    if int(l[i][0]) != 0:
        wa += int(l[i][1])
print((ac, wa))

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

-l = [[0] * 2 for _ in range(n + 1)] +l = [0] * (n + 1) -    if l[p][0] == 0:  # ACが0の場合 -        if s == "AC": -            l[p][0] = 1 -        else: -            l[p][1] += 1 -for i in range(1, n + 1): -    ac += int(l[i][0]) -    if int(l[i][0]) != 0: -        wa += int(l[i][1]) +    if l[p] == -1: +        continue +    if s == "AC": +        ac += 1 +        wa += l[p] +        l[p] = -1 +    else: +        l[p] += 1