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



wa_stock = [0] * N

ac = 0

wa = 0

stat = ['NA'] * N



for _ in range(M):

    p, S = input().split()

    key = int(p) - 1

    if S == 'WA':

        wa_stock[key] += 1

    elif stat[key] != 'AC' and S == 'AC':

        stat[key] = 'AC'

        ac += 1

        wa += wa_stock[key]



print((ac, wa))

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

ac = set()

wa = 0

wa_stock = [0] * n

for _ in range(m):

    p, s = input().split()

    p = int(p) - 1

    if s == 'AC' and not p in ac:

        ac.add(p)

        wa += wa_stock[p]

    elif not p in ac:

        wa_stock[p] += 1

print((len(ac), wa))
N, M = list(map(int, input().split()))
wa_stock = [0] * N
ac = 0
wa = 0
stat = ["NA"] * N
for _ in range(M):
    p, S = input().split()
    key = int(p) - 1
    if S == "WA":
        wa_stock[key] += 1
    elif stat[key] != "AC" and S == "AC":
        stat[key] = "AC"
        ac += 1
        wa += wa_stock[key]
print((ac, wa))

n, m = list(map(int, input().split()))
ac = set()
wa = 0
wa_stock = [0] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC" and not p in ac:
        ac.add(p)
        wa += wa_stock[p]
    elif not p in ac:
        wa_stock[p] += 1
print((len(ac), wa))

-N, M = list(map(int, input().split())) -wa_stock = [0] * N -ac = 0 +n, m = list(map(int, input().split())) +ac = set() -stat = ["NA"] * N -for _ in range(M): -    p, S = input().split() -    key = int(p) - 1 -    if S == "WA": -        wa_stock[key] += 1 -    elif stat[key] != "AC" and S == "AC": -        stat[key] = "AC" -        ac += 1 -        wa += wa_stock[key] -print((ac, wa)) +wa_stock = [0] * n +for _ in range(m): +    p, s = input().split() +    p = int(p) - 1 +    if s == "AC" and not p in ac: +        ac.add(p) +        wa += wa_stock[p] +    elif not p in ac: +        wa_stock[p] += 1 +print((len(ac), wa))