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

PS = []

for i in range(M):

    p, s = input().split()

    PS.append([int(p), s])



a_w = []

for i in range(N+1):

    a_w.append([False, 0])



a_cnt = 0

w_cnt = 0

for p, s in PS:

    # 正解済み

    if a_w[p][0]:

        continue



    # 初めて正解した

    if s == 'AC':

        a_w[p][0] = True

        a_cnt += 1

        w_cnt += a_w[p][1]

    else:

        a_w[p][1] += 1



# print(a_w)

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

PS = []

for i in range(M):

    p, s = input().split()

    PS.append([int(p), s])



ac = [False] * N

pena = [0] * N



for p, s in PS:

    p -= 1

    if ac[p]:

        continue



    if s == 'AC':

        ac[p] = True

    else:

        pena[p] += 1



a_cnt = 0

w_cnt = 0

for i in range(N):

    if ac[i]:

        a_cnt += 1

        w_cnt += pena[i]



print((a_cnt, w_cnt))
N, M = list(map(int, input().split()))
PS = []
for i in range(M):
    p, s = input().split()
    PS.append([int(p), s])
a_w = []
for i in range(N + 1):
    a_w.append([False, 0])
a_cnt = 0
w_cnt = 0
for p, s in PS:
    # 正解済み
    if a_w[p][0]:
        continue
    # 初めて正解した
    if s == "AC":
        a_w[p][0] = True
        a_cnt += 1
        w_cnt += a_w[p][1]
    else:
        a_w[p][1] += 1
# print(a_w)
print((a_cnt, w_cnt))

N, M = list(map(int, input().split()))
PS = []
for i in range(M):
    p, s = input().split()
    PS.append([int(p), s])
ac = [False] * N
pena = [0] * N
for p, s in PS:
    p -= 1
    if ac[p]:
        continue
    if s == "AC":
        ac[p] = True
    else:
        pena[p] += 1
a_cnt = 0
w_cnt = 0
for i in range(N):
    if ac[i]:
        a_cnt += 1
        w_cnt += pena[i]
print((a_cnt, w_cnt))

-a_w = [] -for i in range(N + 1): -    a_w.append([False, 0]) +ac = [False] * N +pena = [0] * N +for p, s in PS: +    p -= 1 +    if ac[p]: +        continue +    if s == "AC": +        ac[p] = True +    else: +        pena[p] += 1 -for p, s in PS: -    # 正解済み -    if a_w[p][0]: -        continue -    # 初めて正解した -    if s == "AC": -        a_w[p][0] = True +for i in range(N): +    if ac[i]: -        w_cnt += a_w[p][1] -    else: -        a_w[p][1] += 1 -# print(a_w) +        w_cnt += pena[i]