from collections import defaultdict



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

ps = []

for _ in range(m):

    ps.append(input().split())



sub_st = defaultdict(list)

for p, s in ps:

    sub_st[p].append(s)



solved = 0

error = 0

for k, v in list(sub_st.items()):

    temp_error = 0

    for history in v:

        if 'AC' in history:

            error += temp_error

            solved += 1

            break

        temp_error += 1



print((solved, error))

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

did_ac = [False] * N

pn_cnt = [0] * N

for _ in range(M):

    p, s = input().split()

    p = int(p) - 1

    if did_ac[p]:

        continue

    s = s == 'AC'

    if s:

        did_ac[p] = True

    else:

        pn_cnt[p] += 1

print((sum(did_ac), sum(pn_cnt[i] for i in range(N) if did_ac[i])))

from collections import defaultdict

n, m = list(map(int, input().split()))
ps = []
for _ in range(m):
    ps.append(input().split())
sub_st = defaultdict(list)
for p, s in ps:
    sub_st[p].append(s)
solved = 0
error = 0
for k, v in list(sub_st.items()):
    temp_error = 0
    for history in v:
        if "AC" in history:
            error += temp_error
            solved += 1
            break
        temp_error += 1
print((solved, error))

N, M = list(map(int, input().split()))
did_ac = [False] * N
pn_cnt = [0] * N
for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    if did_ac[p]:
        continue
    s = s == "AC"
    if s:
        did_ac[p] = True
    else:
        pn_cnt[p] += 1
print((sum(did_ac), sum(pn_cnt[i] for i in range(N) if did_ac[i])))

-from collections import defaultdict - -n, m = list(map(int, input().split())) -ps = [] -for _ in range(m): -    ps.append(input().split()) -sub_st = defaultdict(list) -for p, s in ps: -    sub_st[p].append(s) -solved = 0 -error = 0 -for k, v in list(sub_st.items()): -    temp_error = 0 -    for history in v: -        if "AC" in history: -            error += temp_error -            solved += 1 -            break -        temp_error += 1 -print((solved, error)) +N, M = list(map(int, input().split())) +did_ac = [False] * N +pn_cnt = [0] * N +for _ in range(M): +    p, s = input().split() +    p = int(p) - 1 +    if did_ac[p]: +        continue +    s = s == "AC" +    if s: +        did_ac[p] = True +    else: +        pn_cnt[p] += 1 +print((sum(did_ac), sum(pn_cnt[i] for i in range(N) if did_ac[i])))