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

ps = {}

for _ in range(m):

    _p, _s = list(map(str, input().split()))

    _p = int(_p)

    ps.setdefault(_p, [])

    ps[_p].append(_s)



ac = 0

wa = 0

for v in list(ps.values()):

    for i, _v in enumerate(v):

        if _v == "AC":

            ac += 1

            wa += i

            break



print((ac, wa))

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

ps = []

for _ in range(m):

    _p, _s = list(map(str, input().split()))

    _p = int(_p)

    ps.append([_p, _s])



ac = [False]*n

wa = [0]*n



for _p, _s in ps:

    if ac[_p-1]:

        continue



    if _s == "AC":

        ac[_p-1] = True

    elif _s == "WA":

        wa[_p-1] += 1



ans = [0, 0]

for _ac, _wa in zip(ac, wa):

    if _ac:

        ans[0] += 1

        ans[1] += _wa



print((*ans))

n, m = list(map(int, input().split()))
ps = {}
for _ in range(m):
    _p, _s = list(map(str, input().split()))
    _p = int(_p)
    ps.setdefault(_p, [])
    ps[_p].append(_s)
ac = 0
wa = 0
for v in list(ps.values()):
    for i, _v in enumerate(v):
        if _v == "AC":
            ac += 1
            wa += i
            break
print((ac, wa))

n, m = list(map(int, input().split()))
ps = []
for _ in range(m):
    _p, _s = list(map(str, input().split()))
    _p = int(_p)
    ps.append([_p, _s])
ac = [False] * n
wa = [0] * n
for _p, _s in ps:
    if ac[_p - 1]:
        continue
    if _s == "AC":
        ac[_p - 1] = True
    elif _s == "WA":
        wa[_p - 1] += 1
ans = [0, 0]
for _ac, _wa in zip(ac, wa):
    if _ac:
        ans[0] += 1
        ans[1] += _wa
print((*ans))

-ps = {} +ps = [] -    ps.setdefault(_p, []) -    ps[_p].append(_s) -ac = 0 -wa = 0 -for v in list(ps.values()): -    for i, _v in enumerate(v): -        if _v == "AC": -            ac += 1 -            wa += i -            break -print((ac, wa)) +    ps.append([_p, _s]) +ac = [False] * n +wa = [0] * n +for _p, _s in ps: +    if ac[_p - 1]: +        continue +    if _s == "AC": +        ac[_p - 1] = True +    elif _s == "WA": +        wa[_p - 1] += 1 +ans = [0, 0] +for _ac, _wa in zip(ac, wa): +    if _ac: +        ans[0] += 1 +        ans[1] += _wa +print((*ans))