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

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

from collections import defaultdict

acs = set()

penas = defaultdict(lambda: 0)

for p,s in ps:

    if p in acs: continue

    if s=='AC':

        acs.add(p)

    else:

        penas[p] += 1



pena = 0

for p in acs:

    pena += penas[p]

print((len(acs), pena))
N,M = list(map(int,input().split()))

PS = [input().split() for i in range(M)]

penas = {}

acs = set()

pena = 0

for p,s in PS:

    if s=='AC':

        if p in acs: continue

        acs.add(p)

        if p in penas:

            pena += penas[p]

    else:

        if p in penas:

            penas[p] += 1

        else:

            penas[p] = 1

print((len(acs), pena))
N, M = list(map(int, input().split()))
ps = [input().split() for i in range(M)]
from collections import defaultdict

acs = set()
penas = defaultdict(lambda: 0)
for p, s in ps:
    if p in acs:
        continue
    if s == "AC":
        acs.add(p)
    else:
        penas[p] += 1
pena = 0
for p in acs:
    pena += penas[p]
print((len(acs), pena))

N, M = list(map(int, input().split()))
PS = [input().split() for i in range(M)]
penas = {}
acs = set()
pena = 0
for p, s in PS:
    if s == "AC":
        if p in acs:
            continue
        acs.add(p)
        if p in penas:
            pena += penas[p]
    else:
        if p in penas:
            penas[p] += 1
        else:
            penas[p] = 1
print((len(acs), pena))

-ps = [input().split() for i in range(M)] -from collections import defaultdict - +PS = [input().split() for i in range(M)] +penas = {} -penas = defaultdict(lambda: 0) -for p, s in ps: -    if p in acs: -        continue +pena = 0 +for p, s in PS: +        if p in acs: +            continue +        if p in penas: +            pena += penas[p] -        penas[p] += 1 -pena = 0 -for p in acs: -    pena += penas[p] +        if p in penas: +            penas[p] += 1 +        else: +            penas[p] = 1