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

d = {}

s_ac = set()

ac = 0

pen = 0

for i in range(m):

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

    p = int(p)

    if s == 'AC':

        if p not in s_ac:

            ac += 1

            s_ac.add(p)

            if p in d:

                pen += d[p]

    else:

        if p not in d:

            d[p] = 1

        else:

            d[p] += 1

print((ac, pen))

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



a = [0]*n

b = [0]*n



for i in range(m):

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

    p = int(p)

    p -= 1

    if s == 'AC':

        a[p] = 1

    else:

        if a[p] == 0:

            b[p] += 1



c = 0

d = 0

for i in range(n):

    if a[i] != 0:

        c += a[i]

        d += b[i]

print((c, d))

n, m = list(map(int, input().split()))
d = {}
s_ac = set()
ac = 0
pen = 0
for i in range(m):
    p, s = list(map(str, input().split()))
    p = int(p)
    if s == "AC":
        if p not in s_ac:
            ac += 1
            s_ac.add(p)
            if p in d:
                pen += d[p]
    else:
        if p not in d:
            d[p] = 1
        else:
            d[p] += 1
print((ac, pen))

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

-d = {} -s_ac = set() -ac = 0 -pen = 0 +a = [0] * n +b = [0] * n +    p -= 1 -        if p not in s_ac: -            ac += 1 -            s_ac.add(p) -            if p in d: -                pen += d[p] +        a[p] = 1 -        if p not in d: -            d[p] = 1 -        else: -            d[p] += 1 -print((ac, pen)) +        if a[p] == 0: +            b[p] += 1 +c = 0 +d = 0 +for i in range(n): +    if a[i] != 0: +        c += a[i] +        d += b[i] +print((c, d))