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

seito = 0

penarty = 0

pena = [False for i in range(N+1)]

pena2 = [0 for i in range(N+1)]

for i in range(M):

    p,s = input().split()

    p = int(p)

    if not pena[p]:

        if s == "AC":

            pena[p]=True

            seito += 1

        else:

            pena2[p] += 1



for i in range(N+1):

    if pena[i]:

        penarty += pena2[i]

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

dic = {}

ans = 0

for i in range(M):

    p,s = input().split()

    if s == "AC":

        if p in dic:

            ans += dic[p]

        dic[p] = 0

    else:

        if p in dic:

            if dic[p] != 0:

                dic[p] += 1

        else:

            dic[p] = 1



print((len([1 for i in list(dic.values()) if i==0]),ans))
N, M = list(map(int, input().split()))
seito = 0
penarty = 0
pena = [False for i in range(N + 1)]
pena2 = [0 for i in range(N + 1)]
for i in range(M):
    p, s = input().split()
    p = int(p)
    if not pena[p]:
        if s == "AC":
            pena[p] = True
            seito += 1
        else:
            pena2[p] += 1
for i in range(N + 1):
    if pena[i]:
        penarty += pena2[i]
print((seito, penarty))

N, M = list(map(int, input().split()))
dic = {}
ans = 0
for i in range(M):
    p, s = input().split()
    if s == "AC":
        if p in dic:
            ans += dic[p]
        dic[p] = 0
    else:
        if p in dic:
            if dic[p] != 0:
                dic[p] += 1
        else:
            dic[p] = 1
print((len([1 for i in list(dic.values()) if i == 0]), ans))

-seito = 0 -penarty = 0 -pena = [False for i in range(N + 1)] -pena2 = [0 for i in range(N + 1)] +dic = {} +ans = 0 -    p = int(p) -    if not pena[p]: -        if s == "AC": -            pena[p] = True -            seito += 1 +    if s == "AC": +        if p in dic: +            ans += dic[p] +        dic[p] = 0 +    else: +        if p in dic: +            if dic[p] != 0: +                dic[p] += 1 -            pena2[p] += 1 -for i in range(N + 1): -    if pena[i]: -        penarty += pena2[i] -print((seito, penarty)) +            dic[p] = 1 +print((len([1 for i in list(dic.values()) if i == 0]), ans))