round = int(eval(input()))

points =[0, 0]

for r in range(round):

    taro, hanako = input().split(" ")

    if taro == hanako:

        points[0] += 1

        points[1] += 1

    elif taro > hanako:

        points[0] += 3

    elif taro < hanako:

        points[1] += 3



print((*points))
def lexicographical_order(a, b):

    if a > b:

        return 0

    elif a < b:

        return 1

    else:

        return 2



if __name__ == "__main__":

    n = int(eval(input()))

    taro_point, hanako_point = 0, 0

    for _ in range(n):

        taro_hand, hanako_hand = input().split()

        res = lexicographical_order(taro_hand, hanako_hand)



        if res == 0: 

            taro_point += 3

        elif res == 1:

            hanako_point += 3

        elif res == 2:

            taro_point += 1

            hanako_point += 1



    print((taro_point, hanako_point))

round = int(eval(input()))
points = [0, 0]
for r in range(round):
    taro, hanako = input().split(" ")
    if taro == hanako:
        points[0] += 1
        points[1] += 1
    elif taro > hanako:
        points[0] += 3
    elif taro < hanako:
        points[1] += 3
print((*points))

def lexicographical_order(a, b):
    if a > b:
        return 0
    elif a < b:
        return 1
    else:
        return 2


if __name__ == "__main__":
    n = int(eval(input()))
    taro_point, hanako_point = 0, 0
    for _ in range(n):
        taro_hand, hanako_hand = input().split()
        res = lexicographical_order(taro_hand, hanako_hand)
        if res == 0:
            taro_point += 3
        elif res == 1:
            hanako_point += 3
        elif res == 2:
            taro_point += 1
            hanako_point += 1
    print((taro_point, hanako_point))

-round = int(eval(input())) -points = [0, 0] -for r in range(round): -    taro, hanako = input().split(" ") -    if taro == hanako: -        points[0] += 1 -        points[1] += 1 -    elif taro > hanako: -        points[0] += 3 -    elif taro < hanako: -        points[1] += 3 -print((*points)) +def lexicographical_order(a, b): +    if a > b: +        return 0 +    elif a < b: +        return 1 +    else: +        return 2 + + +if __name__ == "__main__": +    n = int(eval(input())) +    taro_point, hanako_point = 0, 0 +    for _ in range(n): +        taro_hand, hanako_hand = input().split() +        res = lexicographical_order(taro_hand, hanako_hand) +        if res == 0: +            taro_point += 3 +        elif res == 1: +            hanako_point += 3 +        elif res == 2: +            taro_point += 1 +            hanako_point += 1 +    print((taro_point, hanako_point))