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

PM = []

for i in range(M):

    p, s = input().split()

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



PM.sort(key=lambda x:x[0])

# print(PM)





aw = []

for i in range(N+10):

    aw.append([0,0])



a_cnt = 0

w_cnt = 0

for p, m in PM:

    if aw[p][0] == 1:

        pass

    elif m == 'WA':

        aw[p][1] += 1

    elif m == 'AC':

        aw[p][0] = 1



for a, w in aw:

    if a == 1:

        a_cnt += 1

        w_cnt += 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])



a_w = []

for i in range(N+1):

    a_w.append([False, 0])



for p, s in PS:

    if s == 'AC':

        a_w[p][0] = True

    else:

        if not a_w[p][0]:

            a_w[p][1] += 1



a_cnt = 0

w_cnt = 0

for a, w in a_w:

    if a:

        a_cnt += 1

        w_cnt += w

print((a_cnt, w_cnt))
N, M = list(map(int, input().split()))
PM = []
for i in range(M):
    p, s = input().split()
    PM.append([int(p), s])
PM.sort(key=lambda x: x[0])
# print(PM)
aw = []
for i in range(N + 10):
    aw.append([0, 0])
a_cnt = 0
w_cnt = 0
for p, m in PM:
    if aw[p][0] == 1:
        pass
    elif m == "WA":
        aw[p][1] += 1
    elif m == "AC":
        aw[p][0] = 1
for a, w in aw:
    if a == 1:
        a_cnt += 1
        w_cnt += 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])
a_w = []
for i in range(N + 1):
    a_w.append([False, 0])
for p, s in PS:
    if s == "AC":
        a_w[p][0] = True
    else:
        if not a_w[p][0]:
            a_w[p][1] += 1
a_cnt = 0
w_cnt = 0
for a, w in a_w:
    if a:
        a_cnt += 1
        w_cnt += w
print((a_cnt, w_cnt))

-PM = [] +PS = [] -    PM.append([int(p), s]) -PM.sort(key=lambda x: x[0]) -# print(PM) -aw = [] -for i in range(N + 10): -    aw.append([0, 0]) +    PS.append([int(p), s]) +a_w = [] +for i in range(N + 1): +    a_w.append([False, 0]) +for p, s in PS: +    if s == "AC": +        a_w[p][0] = True +    else: +        if not a_w[p][0]: +            a_w[p][1] += 1 -for p, m in PM: -    if aw[p][0] == 1: -        pass -    elif m == "WA": -        aw[p][1] += 1 -    elif m == "AC": -        aw[p][0] = 1 -for a, w in aw: -    if a == 1: +for a, w in a_w: +    if a: