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

is_ac = [False]*n

ac = 0

was = [0]*n

for _ in range(m):

    p, s = input().split()

    p = int(p) - 1

    if s=='AC' and (not is_ac[p]):

        ac += 1

        is_ac[p] = True

    if s=='WA' and (not is_ac[p]):

        was[p] += 1

wa = 0

for i in range(n):

    if is_ac[i]:

        wa += was[i]

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

ps = []

for _ in range(m):

    p, s = input().split()

    ps.append((int(p), s))

was = [0]*(n+1)

total_ac = 0

total_wa = 0

for p, s in ps:

    if was[p]<0:

        continue

    if s=='AC':

        total_wa += was[p]

        total_ac += 1

        was[p] = -1

    else:

        was[p] += 1

print((total_ac, total_wa))
n, m = list(map(int, input().split()))
is_ac = [False] * n
ac = 0
was = [0] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC" and (not is_ac[p]):
        ac += 1
        is_ac[p] = True
    if s == "WA" and (not is_ac[p]):
        was[p] += 1
wa = 0
for i in range(n):
    if is_ac[i]:
        wa += was[i]
print((ac, wa))

n, m = list(map(int, input().split()))
ps = []
for _ in range(m):
    p, s = input().split()
    ps.append((int(p), s))
was = [0] * (n + 1)
total_ac = 0
total_wa = 0
for p, s in ps:
    if was[p] < 0:
        continue
    if s == "AC":
        total_wa += was[p]
        total_ac += 1
        was[p] = -1
    else:
        was[p] += 1
print((total_ac, total_wa))

-is_ac = [False] * n -ac = 0 -was = [0] * n +ps = [] -    p = int(p) - 1 -    if s == "AC" and (not is_ac[p]): -        ac += 1 -        is_ac[p] = True -    if s == "WA" and (not is_ac[p]): +    ps.append((int(p), s)) +was = [0] * (n + 1) +total_ac = 0 +total_wa = 0 +for p, s in ps: +    if was[p] < 0: +        continue +    if s == "AC": +        total_wa += was[p] +        total_ac += 1 +        was[p] = -1 +    else: -wa = 0 -for i in range(n): -    if is_ac[i]: -        wa += was[i] -print((ac, wa)) +print((total_ac, total_wa))