f=lambda:input().split()

n,m=list(map(int,f()))

sa,lw=set(),[0]*n

for _ in range(m):

  p,s=f()

  if p in sa: continue

  if s=='AC': sa.add(p)

  else: lw[int(p)-1]+=1

print((len(sa),sum(lw[int(p)-1] for p in sa)))
f=lambda:input().split()

n,m=list(map(int,f()))

n+=1

a,w=[0]*n,[0]*n

for _ in range(m):

  p,s=f()

  p=int(p)

  if s=='AC': a[p]=1

  elif a[p]<1: w[p]+=1

print((sum(a),sum(i*j for i,j in zip(a,w))))
f = lambda: input().split()
n, m = list(map(int, f()))
sa, lw = set(), [0] * n
for _ in range(m):
    p, s = f()
    if p in sa:
        continue
    if s == "AC":
        sa.add(p)
    else:
        lw[int(p) - 1] += 1
print((len(sa), sum(lw[int(p) - 1] for p in sa)))

f = lambda: input().split()
n, m = list(map(int, f()))
n += 1
a, w = [0] * n, [0] * n
for _ in range(m):
    p, s = f()
    p = int(p)
    if s == "AC":
        a[p] = 1
    elif a[p] < 1:
        w[p] += 1
print((sum(a), sum(i * j for i, j in zip(a, w))))

-sa, lw = set(), [0] * n +n += 1 +a, w = [0] * n, [0] * n -    if p in sa: -        continue +    p = int(p) -        sa.add(p) -    else: -        lw[int(p) - 1] += 1 -print((len(sa), sum(lw[int(p) - 1] for p in sa))) +        a[p] = 1 +    elif a[p] < 1: +        w[p] += 1 +print((sum(a), sum(i * j for i, j in zip(a, w))))