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

ps=list(list(input().split()) for _ in range(m))



wal=[0]*n

acl=[0]*n



for p,s in ps:

    p=int(p)-1

    if s=='AC' and acl[p] ==0:

        acl[p]+=1

    elif s=='WA' and acl[p] ==0:

        wal[p]+=1



wa=0

for i,ac in enumerate(acl):

    if ac == 1:

        wa+=wal[i]    

    

print((sum(acl),wa))
n,m=list(map(int,input().split()))

ps=[input().split() for i in range(m)]



acl=[0]*n

wal=[0]*n

for p,s in ps:

    p=int(p)-1

    if s=='AC' and acl[p]==0:

        acl[p]+=1

    elif s=='WA' and acl[p]==0:

        wal[p]+=1



wa=0

for i,ac in enumerate(acl):

    if ac==1:

        wa+=wal[i]

print((sum(acl),wa))
n, m = list(map(int, input().split()))
ps = list(list(input().split()) for _ in range(m))
wal = [0] * n
acl = [0] * n
for p, s in ps:
    p = int(p) - 1
    if s == "AC" and acl[p] == 0:
        acl[p] += 1
    elif s == "WA" and acl[p] == 0:
        wal[p] += 1
wa = 0
for i, ac in enumerate(acl):
    if ac == 1:
        wa += wal[i]
print((sum(acl), wa))

n, m = list(map(int, input().split()))
ps = [input().split() for i in range(m)]
acl = [0] * n
wal = [0] * n
for p, s in ps:
    p = int(p) - 1
    if s == "AC" and acl[p] == 0:
        acl[p] += 1
    elif s == "WA" and acl[p] == 0:
        wal[p] += 1
wa = 0
for i, ac in enumerate(acl):
    if ac == 1:
        wa += wal[i]
print((sum(acl), wa))

-ps = list(list(input().split()) for _ in range(m)) +ps = [input().split() for i in range(m)] +acl = [0] * n -acl = [0] * n