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

resultList = [[0 for i in range(2)] for j in range(n)]

#print(resultList)

for i in range(m) :

    result = input().split()

    prob = int(result[0]) - 1

    #print(resultList, result[1])

    if result[1] == 'AC' and resultList[prob][0] == 0 :

        resultList[prob][0] = 1

    if result[1] == 'WA' and resultList[prob][0] == 0 :

        resultList[prob][1] += 1



#print(resultList)



ansAC = 0

ansWA = 0

for i in range(n) :

    ansAC += resultList[i][0]

    if resultList[i][0] == 1 :

        ansWA += resultList[i][1]



print((ansAC, ansWA))

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

resultList = [[0] * 2 for i in range(n)]

#print(resultList)

ansAC = 0

ansWA = 0

for i in range(m) :

    result = input().split()

    prob = int(result[0]) - 1

    if result[1] == 'AC' and resultList[prob][0] == 0 :

        resultList[prob][0]= 1

        ansAC += 1

        ansWA += resultList[prob][1]

    if result[1] == 'WA' and resultList[prob][0] == 0 :

        resultList[prob][1] += 1



print((ansAC, ansWA))

n, m = list(map(int, input().split()))
resultList = [[0 for i in range(2)] for j in range(n)]
# print(resultList)
for i in range(m):
    result = input().split()
    prob = int(result[0]) - 1
    # print(resultList, result[1])
    if result[1] == "AC" and resultList[prob][0] == 0:
        resultList[prob][0] = 1
    if result[1] == "WA" and resultList[prob][0] == 0:
        resultList[prob][1] += 1
# print(resultList)
ansAC = 0
ansWA = 0
for i in range(n):
    ansAC += resultList[i][0]
    if resultList[i][0] == 1:
        ansWA += resultList[i][1]
print((ansAC, ansWA))

n, m = list(map(int, input().split()))
resultList = [[0] * 2 for i in range(n)]
# print(resultList)
ansAC = 0
ansWA = 0
for i in range(m):
    result = input().split()
    prob = int(result[0]) - 1
    if result[1] == "AC" and resultList[prob][0] == 0:
        resultList[prob][0] = 1
        ansAC += 1
        ansWA += resultList[prob][1]
    if result[1] == "WA" and resultList[prob][0] == 0:
        resultList[prob][1] += 1
print((ansAC, ansWA))

-resultList = [[0 for i in range(2)] for j in range(n)] +resultList = [[0] * 2 for i in range(n)] +ansAC = 0 +ansWA = 0 -    # print(resultList, result[1]) +        ansAC += 1 +        ansWA += resultList[prob][1] -# print(resultList) -ansAC = 0 -ansWA = 0 -for i in range(n): -    ansAC += resultList[i][0] -    if resultList[i][0] == 1: -        ansWA += resultList[i][1]