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

acount=0

wcount=0

a=[0]*n

w=[0]*n

for i in range(m):

  p,m=list(map(str,input().split()))

  p=int(p)

  if m=="AC":

    if a[p-1]==0:

      acount+=1

      a[p-1]+=1

  else:

    if a[p-1]==0:

      w[p-1]+=1

      

for i in range(n):

  if a[i-1]==1:

    wcount+=w[i-1]

    

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

acount=0

wcount=0

a=[False]*n

w=[0]*n

for i in range(m):

  p,m=input().split()

  p=int(p)

  if m=="AC":

    if a[p-1]==False:

      acount+=1

      a[p-1]=True

  else:

    if a[p-1]==False:

      w[p-1]+=1

      

for i in range(n):

  if a[i-1]==1:

    wcount+=w[i-1]

    

print((acount,wcount))
n, m = list(map(int, input().split()))
acount = 0
wcount = 0
a = [0] * n
w = [0] * n
for i in range(m):
    p, m = list(map(str, input().split()))
    p = int(p)
    if m == "AC":
        if a[p - 1] == 0:
            acount += 1
            a[p - 1] += 1
    else:
        if a[p - 1] == 0:
            w[p - 1] += 1
for i in range(n):
    if a[i - 1] == 1:
        wcount += w[i - 1]
print((acount, wcount))

n, m = list(map(int, input().split()))
acount = 0
wcount = 0
a = [False] * n
w = [0] * n
for i in range(m):
    p, m = input().split()
    p = int(p)
    if m == "AC":
        if a[p - 1] == False:
            acount += 1
            a[p - 1] = True
    else:
        if a[p - 1] == False:
            w[p - 1] += 1
for i in range(n):
    if a[i - 1] == 1:
        wcount += w[i - 1]
print((acount, wcount))

-a = [0] * n +a = [False] * n -    p, m = list(map(str, input().split())) +    p, m = input().split() -        if a[p - 1] == 0: +        if a[p - 1] == False: -            a[p - 1] += 1 +            a[p - 1] = True -        if a[p - 1] == 0: +        if a[p - 1] == False: