Problem:
Card Game Taro and Hanako are playing card games. They have n cards each, and they compete n turns. At each turn Taro and Hanako respectively puts out a card.
  The name of the animal consisting of alphabetical letters is written on each card, and the bigger one in lexicographical order becomes the winner of that turn. The winner obtains 3 points. In the case of a draw, they obtain 1 point each. Write a program which reads a sequence of cards Taro and Hanako have and reports the final scores of the game. Input In the first line, the number of cards n is given. In the following n lines, the cards for n turns are given respectively. For each line, the first string represents the Taro's card and the second one represents Hanako's card. Constraints  n ≤ 1000  The length of the string ≤ 100  Output Print the final scores of Taro and Hanako respectively. Put a single space character between them. Sample Input 3
cat dog
fish fish
lion tiger Sample Output 1 7

Solution (Python):
taro_point=0
hanako_point=0
n=int(input())
for i in range(n):
    taro_card,hanako_card=input().split()
    if taro_card>hanako_card:
        taro_point+=3
    elif taro_card<hanako_card:
        hanako_point+=3
    else:
        taro_point+=1
        hanako_point+=1
print(taro_point,hanako_point)

Solution (Python):
n=int(input())
t=0
h=0
for i in range(n):
    a,b=input().split()
    if a>b:
        t+=3
    elif a==b:
        t+=1
        h+=1
    else:
        h+=3
print(t,h)

Solution (Python):
n = int(input())
Taro_ten = 0
Hanako_ten = 0
for i in range(n) :
    a, b = list(input().split())
    Taro = list(a)
    Hanako = list(b)
    length = min(len(Taro), len(Hanako))
    for i in range(length) :
        if ord(Taro[i]) > ord(Hanako[i]) :
            Taro_ten += 3
            break
        elif ord(Taro[i]) < ord(Hanako[i]) :
            Hanako_ten += 3
            break
        if i == length -1 :
            if len(Taro) > length :
                Taro_ten += 3
            elif len(Hanako) > length :
                Hanako_ten += 3
            else :
                Taro_ten += 1
                Hanako_ten += 1
print(Taro_ten, Hanako_ten)

Solution (Python):
x=int(input())
list=[]
c=0
d=0
for i in range(x):
    a,b=input().split()
    
    if a<b:
        d+=3
    elif a>b:
        c+=3
    else:
        c+=1
        d+=1
    
print(c,d)

Solution (Python):
N=int(input())
s=0
t=0
for i in range(N):
    a,b=input().split()
    if a<b:
        s+=3
    elif a==b:
        s+=1
        t+=1
    else:
        t+=3
print(t,s)

Solution (Python):
x = int(input())
T = 0
H = 0
for i in range(x):
    a, b = map(str, input().split())
    if a > b: T += 3
    elif a < b: H += 3
    else:
        T += 1
        H += 1
print(T, H)

Solution (Python):
n=int(input())
H=[]
T=[]
for i in range (n):
    a=list(map(str, input().split())) 
    if a[0]>a[1] :
        H.append(3)
    elif a[0]<a[1] :
        T.append(3)
    else :
        H.append(1)
        T.append(1)
        

print(sum(H), sum(T))

Solution (Python):
t = 0
h = 0
for i in range(int(input())):
    a, b = input().split()
    if a > b:
        t += 3
    elif a < b:
        h += 3
    else:
        t += 1
        h += 1
print(t, h)

Solution (Python):
c,d=0,0
for i in range(int(input())):
    a,b=map(str,input().split())
    if a>b:
        c+=3
    elif b>a:
        d+=3
    else:
        c+=1
        d+=1
print(c, d)

Solution (Python):
leftp,rightp=0,0
loopnum = int(input())

for i in range(loopnum):
    st=input().split()
    stnew = sorted(st)
        
    if st[0]==st[1]:
        leftp = leftp+1
        rightp = rightp+1
    elif st != stnew:
        leftp=leftp+3
    elif st == stnew:
        rightp = rightp+3
        
print(str(leftp)+" "+str(rightp))

Solution (Python):
n=int(input())

taro=0
hanako=0

for i in range(n):
    T,H=map(str,input().split())
    if T<H:
        hanako+=3
    elif T>H:
        taro+=3
    else:
        taro+=1
        hanako+=1

print(taro, hanako)

Solution (Python):
n = int(input())
t = 0
h = 0
for i in range(0, n):
  a, b = input().split()
  if a < b:
    h += 3
  elif a > b:
    t += 3
  else:
    t += 1
    h += 1
print(t, h)

Solution (Python):
n = int(input())
point = [0, 0]
for i in range(n):
    a, b = input().split()
    if a > b:
        point[0] += 3
    elif a < b:
        point[1] += 3
    else:
        point[0] += 1
        point[1] += 1
print(*point)

Solution (Python):
n = int(input())
T = 0
H = 0
for i in range(n):
  a, b = input().split()
  if a > b:
    T += 3
  elif a == b:
    T += 1
    H += 1
  else:
    H += 3
print(T, H)

Solution (Python):
N=int(input())
x=0
y=0
for i in range(N):
    a,b=input().split()
    if a<b:
        y+=3
    elif a==b:
        x+=1
        y+=1
    else:
        x+=3
print(x,y)

Solution (Python):
a,b = 0,0
n = int(input())
for _ in range(n):
    s,t = input().split()
    if s==t:
        a,b = a+1,b+1
    elif s<t:
        b += 3
    else:
        a += 3
print(a,b)

Solution (Python):
n=int(input())
x=0 
y=0 
for i in range(n):
    a,b=input().split()
    if a<b:
        y+=3
    elif a==b:
        x+=1
        y+=1
    else:
        x+=3
print(x,y)

Solution (Python):
class Human:
    def __init__(self, name, card = "", point = 0):
        self.name = name
        self.card = card
        self.point = point
    
    def add_point(self, opponent):
        if self.card > opponent:
            self.point += 3
        elif self.card == opponent:
            self.point += 1
        else:
            pass

Taro = Human('Taro')
Hanako = Human('Hanako')

N = int(input())
for n in range(N):
    Taro.card, Hanako.card = input().split()
    Taro.add_point(Hanako.card)
    Hanako.add_point(Taro.card)

print(Taro.point, Hanako.point)

Solution (Python):
    
from enum import Enum
import sys

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


class Type(Enum):
    win_Taro = 0
    win_Hanako = 1
    EVEN = 2

def comp_str(A,B):
    if A > B:
        return Type.win_Taro
    elif A < B:
        return Type.win_Hanako
    else:
        return Type.EVEN

N = int(input())

point_Taro = 0
point_Hanako = 0

for loop in range(N):
    line = str(input()).split()
    ret_type = comp_str(line[0],line[1])
    if ret_type == Type.win_Taro:
        point_Taro += 3
    elif ret_type == Type.win_Hanako:
        point_Hanako += 3
    else:
        point_Taro += 1
        point_Hanako += 1

print("%d %d"%(point_Taro,point_Hanako))

Solution (Python):
N = int( input() )

AP = 0
BP = 0


for i in range(N):
    A,B = input().split()
    sa = 0
    X = max( len(A) , len(B) )
    A = A.ljust(X, '0')
    B = B.ljust(X, '0')
    if A == B:
        AP += 1
        BP += 1
    else:
        for j in range(X):
            if ord( A[j] ) > ord( B[j] ):
                AP += 3
                break
            elif ord( B[j] ) > ord( A[j] ):
                BP += 3
                break
            else:
                pass
print( AP,BP, sep=' ')

Solution (Python):
n = int(input())
a = 0
b = 0
for i in range(n):
    word = list(input().split())
    new_word = sorted(word)
    if word[0] == word[1]:
        a += 1
        b += 1
    elif new_word == word:
        b += 3
    else:
        a += 3
print('{} {}'.format(a, b))

Solution (Python):
n = int(input())
Taro_ten = 0
Hanako_ten = 0
for i in range(n) :
    a, b = list(input().split())
    Taro = list(a)
    Hanako = list(b)
    length = min(len(Taro), len(Hanako))
    for i in range(length) :
        if ord(Taro[i]) > ord(Hanako[i]) :
            Taro_ten += 3
            break
        elif ord(Taro[i]) < ord(Hanako[i]) :
            Hanako_ten += 3
            break
        if i == length -1 :
            if len(Taro) > length :
                Taro_ten += 3
            elif len(Hanako) > length :
                Hanako_ten += 3
            else :
                Taro_ten += 1
                Hanako_ten += 1
print(Taro_ten, Hanako_ten)

Solution (Python):
turn = int(input())

point_taro = point_hanako = 0

for i in range(turn):
    taro,hanako = input().split()

    if taro > hanako:
        point_taro += 3
    elif hanako > taro:
        point_hanako += 3
    else:
        point_taro += 1
        point_hanako += 1

print("{} {}".format(point_taro,point_hanako))

Solution (Python):
n=int(input())
x=0
y=0
for i in range(n):
    a,b=input().split()
    if a>b:
        x+=3
    elif a==b:
        x+=1
        y+=1
    else:
        y+=3
print(x,y)

Solution (Python):
n = int(input())
Taro_ten = 0
Hanako_ten = 0
for i in range(n) :
    a, b = list(input().split())
    Taro = list(a)
    Hanako = list(b)
    length = min(len(Taro), len(Hanako))
    for i in range(length) :
        if ord(Taro[i]) > ord(Hanako[i]) :
            Taro_ten += 3
            break
        elif ord(Taro[i]) < ord(Hanako[i]) :
            Hanako_ten += 3
            break
        if i == length -1 :
            if len(Taro) > length :
                Taro_ten += 3
            elif len(Hanako) > length :
                Hanako_ten += 3
            else :
                Taro_ten += 1
                Hanako_ten += 1
print(Taro_ten, Hanako_ten)

Solution (Python):
taro_point = 0
hanako_point = 0
N = int(input())
for _ in range(N):
    taro,hanako = input().split()
    list = [taro,hanako]
    list_new = sorted(list)
    if taro == hanako:
        taro_point += 1
        hanako_point += 1
    elif list_new[1] == hanako:
        hanako_point +=3
    elif list_new[1] == taro:
        taro_point += 3
print(str(taro_point),str(hanako_point))

Solution (Python):




def main():
    T = H = 0
    n = int(input())
    for i in range(n):
        t, h = input().split()
        if t > h:
            T += 3
        elif t < h:
            H += 3
        else:
            T += 1
            H += 1

    print(f"{T} {H}")


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=0
b=0
for i in range(n):
    A,B=map(str,input().split())
    if A>B:
        a+=3
    if A<B:
        b+=3
    if A==B:
        a+=1
        b+=1
print(a,b)

Solution (Python):
n = int(input())
cards = [input().split() for i in range(n)]

taroScore = 0
hanakoScore = 0

for i in range(n):
    sortedCards = sorted(cards[i])
    if cards[i][0] == cards[i][1]:
        taroScore += 1
        hanakoScore += 1
    elif cards[i][0] == sortedCards[0]:
      hanakoScore += 3
    else:
        taroScore += 3

print(taroScore, hanakoScore)

Solution (Python):
n=int(input())
T=0
H=0
for i in range(n):
    card_t,card_h=input().split()
    if card_t==card_h:
        T+=1
        H+=1
    else:
        if card_h>card_t:
            H+=3
        else:
            T+=3
print(T,H)

Solution (Python):
n=int(input())
x=0
y=0
for i in range(n):
    a,b=input().split()
    if a>b:
        x +=3
    if a<b:
        y +=3
    if a==b:
        x +=1
        y +=1
print(x,y)

Solution (Python):
n=int(input())
T=0
H=0
for i in range(n):
    t,h=input().split()
    if t==h:
        T+=1
        H+=1
    else:
        if t>h:
            T+=3
        else:
            H+=3
    
print(T,H)

Solution (Python):
n = int(input())
x, y = 0, 0
for _ in range(n):
    info = input().split()
    if info[0] > info[1]:
        x += 3
    elif info[0] < info[1]:
        y += 3
    else:
        x += 1
        y += 1
print(x, y)

Solution (Python):
n=int(input())
T=0
H=0
for i in range(n):
    card_t,card_h=input().split()
    if card_t==card_h:
        T+=1
        H+=1
    else:
        if card_h>card_t:
            H+=3
        else:
            T+=3
print(T,H)

Solution (Python):
T,H = 0,0
n = int(input())
for i in range(n):
    S1,S2 = input().split()
    if S1 < S2:
        H += 3
    elif S1 > S2:
        T += 3
    else:
        T += 1
        H += 1
print(T,H)

Solution (Python):
n = int(input())
Taro_ans = 0
Hanako_ans = 0
for i in range(n) :
    a, b = list(input().split())
    Taro = list(a)
    Hanako = list(b)
    length = min(len(Taro), len(Hanako))
    for i in range(length) :
        if ord(Taro[i]) > ord(Hanako[i]) :
            Taro_ans += 3
            break
        elif ord(Taro[i]) < ord(Hanako[i]) :
            Hanako_ans += 3
            break
        if i == length -1 :
            if len(Taro) > length :
                Taro_ans += 3
            elif len(Hanako) > length :
                Hanako_ans += 3
            else :
                Taro_ans += 1
                Hanako_ans += 1
print(Taro_ans, Hanako_ans)

Solution (Python):
n=int(input())
taro=0
hanako=0
for i in range(n):
    t,h=map(str,input().split())
    if t>h:
        taro += 3
    elif h>t:
        hanako += 3
    else:
        taro += 1
        hanako += 1
print(taro,hanako)

Solution (Python):
n=int(input())
a=0
b=0
for i in range(n):
    c,d=input().split()
    if c<d:
        b+=3
    elif c>d:
        a+=3
    else:
        b+=1
        a+=1
print(a,b)

Solution (Python):
N=int(input())
x=0
y=0
for i in range(N):
    a,b=input().split()
    if a<b:
        y+=3
    elif a==b:
        x+=1
        y+=1
    else:
        x+=3
print(x,y)

Solution (Python):
n = int(input())
cards = [input().split() for _ in range(n)]
p_t = 0
p_h = 0
for card in cards:
    if card[0] == card[1]:
        p_t += 1
        p_h += 1
    elif card[0] > card[1]:
        p_t += 3
    else:
        p_h += 3
print(p_t, p_h)

Solution (Python):
turn = int(input())
tp, hp = 0, 0
for i in range(turn):
    t, h = input().split()
    if t == h:
        tp += 1
        hp += 1
    elif t > h:
        tp += 3
    elif t < h:
        hp += 3
print(tp, hp)

Solution (Python):

class player:
    def __init__(self):
        self.my_cards=[]
        self.point=0
    def draw(self,letter):
        self.my_cards.append(letter)

    def open(self,num):
        return self.my_cards[num]
    
    def buttle(self,letter,num):
        if(self.my_cards[num]>letter):
            self.point+=3
        elif(self.my_cards[num]==letter):
            self.point+=1
            
    def show(self):
        return self.point
    def check(self):
        return self.my_cards


n=int(input())
taro=player()
hanako=player()
for i in range(n):
    val=input().split()
    taro.draw(val[0])
    hanako.draw(val[1])
for i in range(n):
    taro.buttle(hanako.open(i),i)
    hanako.buttle(taro.open(i),i)
    
print(taro.show(),hanako.show())

Solution (Python):
def main(listseq):
    x = y = 0
    for strings in listseq:
        a, b = strings.split(" ")
        if a < b: y += 3
        elif a > b: x += 3
        elif a == b: x += 1; y += 1
    return x, y


times = int(input())
words = [input() for _ in range(times)]
a, b = main(words)
print(f"{a} {b}")

Solution (Python):
n = int(input())
Tp = 0
Hp = 0
tmp = "abcdefghijklmnopqrstuvwxyz"
alph = list(tmp)

for i in range(n):
    Ta,Ha = input().split()
    lTa = list(Ta)
    lHa = list(Ha)
    num = 0

    if (len(Ta) <= len(Ha)):  
        num = len(Ta)

    else:
        num = len(Ha)

    if (Ta in Ha and lTa[0] == lHa[0]): 
        if (Ta == Ha):
            Tp += 1
            Hp += 1
        else:
            Hp += 3

    elif (Ha in Ta and Ha != Ta and lTa[0] == lHa[0]):
        Tp += 3


    else:
        for i in range(len(lTa)):  
            for j in range(26):
                if (lTa[i] == alph[j]):
                    lTa[i] = int(j)

                else :
                    continue

        for i in range(len(lHa)):  
            for j in range(26):
                if (lHa[i] == alph[j]):
                    lHa[i] = int(j)

                else :
                    continue

        for i in range(num):
            if (lTa[i] < lHa[i]):
                Hp +=3
                break
            elif (lHa[i] < lTa[i]):
                Tp +=3
                break
            elif (lHa[i] == lTa[i]):
                continue

print(Tp,Hp)

Solution (Python):
N=int(input())
right=0
left=0
for i in range(N):
    a,b=input().split()
    if a>b:
        left+=3
    elif a<b:
        right+=3
    else:
        left+=1
        right+=1
print(f"{left} {right}")

Solution (Python):
from enum import Enum

class Type(Enum):
    win_Taro = 0
    win_Hanako = 1
    Even = 2

def comp_str(A, B):
    if A > B:
        return Type.win_Taro
    elif A < B:
        return Type.win_Hanako
    else:
        return Type.Even

N = int(input())

point_Taro = 0
point_Hanako = 0

for loop in range(N):
    line = str(input()).split()
    ret_type = comp_str(line[0], line[1])
    if ret_type == Type.win_Taro:
        point_Taro += 3
    elif ret_type == Type.win_Hanako:
        point_Hanako += 3
    else:
        point_Taro += 1
        point_Hanako += 1

print("%d %d"%(point_Taro, point_Hanako))

Solution (Python):
taro = 0
hanako = 0

n = int(input())
for i in range(n):
    t, h = input().split()
    if t < h:
        hanako += 3
    elif t == h:
        taro += 1
        hanako += 1
    elif h < t:
        taro += 3
print("%d %d" % (taro, hanako))

Solution (Python):
n=int(input())
tp=0
hp=0
for i in range(n):
  taro,hanako=(str(buff) for buff in input().split())
  if taro>hanako:
    tp+=3
  elif taro<hanako:
    hp+=3
  else:
    tp+=1
    hp+=1
print(tp,hp)

Solution (Python):
n = int(input())

t, h = 0, 0

for i in range(n):
    s1, s2 = input().split()
    if s1 > s2:
        t += 3
    elif s1 < s2:
        h += 3
    else:
        t += 1
        h += 1

print(t, h)

Solution (Python):
h=t=0
for _ in range(int(input())):
    a,b=input().split()
    if a>b:t+=3
    elif a<b:h+=3
    else:t+=1;h+=1
print(t,h)

Solution (Python):
n = int(input())
count_taro = 0
count_hanako = 0
for i in range(n):
  taro,hanako = map(str, input().split())
  if taro > hanako:
    count_taro += 3
  if hanako > taro:
    count_hanako += 3
  if hanako == taro:
    count_hanako += 1
    count_taro += 1
print(count_taro, count_hanako)

Solution (Python):
n=int(input())
m=0
l=0
for i in range(n):
    a=[]
    x,y=map(str,input().split())
    a.append(x)
    a.append(y)
    b=sorted(a)
    if x==y:
        m+=1
        l+=1
    else:
        if x==b[1]:
            m+=3
        elif y==b[1]:
            l+=3
print(m,l)

Solution (Python):
n=int(input())
taro=0
hanako=0
for i in range(n):
    a,b=map(str,input().split())
    if a>b:
        taro+=3
    elif a<b:
        hanako+=3
    else:
        taro+=1
        hanako+=1
        
print(taro,hanako)

Solution (Python):
n=int(input())
a=0
b=0
for i in range(n):
    A,B=map(str,input().split())
    if A>B:
        a+=3
    if A<B:
        b+=3
    if A==B:
        a+=1
        b+=1
print(a,b)

Solution (Python):
n=int(input())
c=[input().split() for i in range(n)]

t=0
h=0

for j in c:
    if j[0]>j[1]:
        t+=3
    elif j[0]<j[1]:
        h+=3
    else:
        t+=1
        h+=1
print(t, h)

Solution (Python):
while True:
    try:
        a = int(input())
        t=0
        h=0
        for i in range(a):
            b,c=input().split()
            if b>c:
                t+=3
            elif c>b:
                h+=3
            else:
                t+=1
                h+=1
        print(t,h)
    except EOFError:break

Solution (Python):
n = int(input())
T = 0
H = 0
for _ in range(n):
    t, h = map(str, input().split())
    if t > h:
        T += 3
    elif t < h:
        H += 3
    else:
        T += 1
        H += 1
print(T, H)

Solution (Python):
turn=int(input())
duel=[input().split(" ")for i in range(turn)]
point=[0,0]
for i in duel:
    if i[0]==i[1]:
        point[0],point[1]=point[0]+1,point[1]+1
    if i[0]>i[1]:
        point[0]+=3
    if i[0]<i[1]:
        point[1]+=3
print(" ".join(map(str,point)))

Solution (Python):
n = int(input())
ta = 0
ha = 0

for i in range(n):
    taha = list(map(str, input().split()))
    jud = sorted(taha)
    
    
    if taha[0] == taha[1]:
        ta += 1
        ha += 1
    
    elif taha[0] == jud[0]:
        ha += 3

    else:
        ta += 3

print("{} {}" .format(ta, ha))

Solution (Python):
n = int(input())
a = 0
b = 0
for i in range(n):
  t1,t2 = input().split()
  if t1>t2:
    a+=3
  elif t1==t2:
    a+=1
    b+=1
  else:
    b+=3
print(a,b)

Solution (Python):
n = int(input())
r = s = 0
for i in range(n):
  a, b = input().split()
  if a > b:
    r += 3
  elif a < b:
    s += 3
  else:
    r += 1; s += 1
print(r,s)

Solution (Python):
N = int(input())
tarou = 0
hanako = 0
for _ in range(N):
    t,h = input().split()
    if t == h:
        tarou += 1
        hanako += 1
    elif [t,h] != sorted([t,h]):
        tarou += 3
    else:
        hanako += 3
print(tarou, hanako)

Solution (Python):
n = int(input())
card = []
tc = []
hc = []

taro = 0
hanako = 0
counter = 0

i = 0
j = 0
k = 0
for i in range(n):
    card.append(list(input().split()))
    tc.append(list(card[i][0]))
    hc.append(list(card[i][1]))

    if len(card[i][0]) <= len(card[i][1]):
        counter = len(card[i][0])
    else:
        counter = len(card[i][1])
    
    for j in range(counter):
        if ord(tc[i][j].lower()) < ord(hc[i][j].lower()):
            hanako += 3
            break
        elif ord(tc[i][j].lower()) > ord(hc[i][j].lower()):
            taro += 3
            break
        else:
            if j == counter - 1:
                if len(card[i][0]) < len(card[i][1]):
                    hanako += 3
                elif len(card[i][0]) > len(card[i][1]):
                    taro += 3
                else:
                    taro += 1
                    hanako += 1

                break

print("%d %d" % (taro, hanako))

Solution (Python):

n = int(input())
score_t, score_h = 0, 0
for i in range(n):
    t, h = input().split()
    if t > h:
        score_t += 3
    elif h > t:
        score_h += 3
    else:
        score_t += 1
        score_h += 1
print(f"{score_t} {score_h}")

Solution (Python):
x=0
y=0
n=int(input())
for i in range(n):
    s,t=map(str,input().split())
    if s==t : 
        x+=1
        y+=1 
    elif s>t : x+=3
    else : y+=3
print(x,y)

Solution (Python):



n = int(input())
ta = 0
ha = 0
for i in range(n):
    a, b = list(input().split())
    if a == b:
        ta += 1
        ha += 1
    elif a > b:
        ta += 3
    else:
        ha += 3
print(ta,ha)

Solution (Python):
n = int(input())
t_co = h_co = 0

for i in range(n):
    t_str, h_str = list(map(str, input().split()))
    
    if t_str > h_str:
        t_co += 3
    
    elif h_str == t_str:
        t_co += 1
        h_co += 1
    else:
        h_co += 3
        
print(t_co, h_co)

Solution (Python):
n = int(input())
a=0
b=0
for i in range(n):
    t,h = input().split()
    if t==h:
        a += 1
        b += 1
    elif t<h:
        b += 3
    else:
        a += 3
print(a, b)

Solution (Python):
n=int(input())
a=0
b=0
for i in range(n):
    A,B=map(str,input().split())
    if A>B:
        a+=3
    elif A<B:
        b+=3
    else:
        a+=1
        b+=1
print(a,b)

Solution (Python):
n=int(input())
taro = 0
hana = 0
for i in range(n):
    val = list(input().split())
    if val[0]<val[1]:
        hana += 3
    elif val[0]>val[1]:
        taro += 3
    else:
        taro += 1
        hana += 1
print(taro,hana,sep=' ')

Solution (Python):

loop = int(input())
ans = [0, 0]
for _ in range(loop):
    
    arr = input().split()
    
    if arr[0] > arr[1]:
        ans[0] += 3
    elif arr[0] < arr[1]:
        ans[1] += 3
    else:
        ans[0] += 1
        ans[1] += 1

print(ans[0], ans[1])

Solution (Python):
n=int(input())
t=0
h=0
for i in range(n):
    taro,hana=map(str,input().split())
    if taro>hana:
        t+=3
    elif hana>taro:
        h+=3
    else:
        h+=1
        t+=1
print("%s %d"%(t,h))

Solution (Python):
n = int(input())
xx = 0
yy = 0
for i in range(n):
  x,y=map(str,input().split())
  if x>y:
    xx+=3
  elif x<y:
    yy+=3
  else:
    xx+=1
    yy+=1
print(xx,yy)

Solution (Python):
n = int(input());
x = 0;
y = 0;
for i in range(0,n):
    a,b = map(str,input().split());
    if a > b:
        x += 3;
    elif a < b:
        y += 3;
    else:
        x += 1;
        y += 1;

print(x,y);

Solution (Python):
n = int(input())
a=0
b=0
for i in range(n):
    t,h = input().split()
    if t==h:
        a += 1
        b += 1
    elif t<h:
        b += 3
    else:
        a += 3
print(a, b)

Solution (Python):
n=int(input())
alpha='abcdefghijklmnopqrstuvwxyz'
t,h=0,0
for i in range(n):
    x,y=map(str,input().split())
    if x==y:
        t+=1
        h+=1
    elif x<y:
        h+=3
    else:
        t+=3
print(t,h)

Solution (Python):
t=0
h=0
n=int(input())
for i in range(n):
    a,b=map(str,input().split())
    if a==b:
       t+=1
       h+=1
    if a>b:
        t+=3
    if a<b:
        h+=3
print(t,h)

Solution (Python):
n=int(input())
a=0
b=0

for i in range(n):
    A,B=map(str,input().split())
    
    A=list(A)
    B=list(B)
    
    if A>B:
        a+=3
    
    if A==B:
        a+=1
        b+=1
        
    if A<B:
        b+=3
        
    i+=1
    
print(a,b)

Solution (Python):
a=int(input())
sum1=0
sum2=0
for i in range(a):
    b,c=input().split()
    if b>c:
        sum1+=3
    elif b<c:
        sum2+=3
    else:
        sum1+=1
        sum2+=1
print("{} {}".format(sum1,sum2))

Solution (Python):
n=int(input())
s=0
t=0
for i in range(n):
    a,b=input().split()
    if a==b:
        s+=1
        t+=1
    elif a>b:
        s+=3
    elif b>a:
        t+=3
print(f'{s} {t}')

Solution (Python):
n = int(input())
taro, hanako = 0, 0
for _ in range(n):
    
    data = input().split()
    if data[0] > data[1]:
        taro += 3
    elif data[0] < data[1]:
        hanako += 3
    else:
        hanako += 1
        taro += 1
        
print(taro, hanako)

Solution (Python):
n = int(input())
cards = [input().split() for i in range(n)]

p_taro = 0
p_hanako = 0




for i in range(n):
    if cards[i][0] > cards[i][1]:   
        p_taro += 3
    elif cards[i][0] < cards[i][1]:
        p_hanako += 3
    else:
        p_taro += 1
        p_hanako += 1
print(p_taro, p_hanako)

Solution (Python):
n=int(input())
out=[0,0]
for _ in range(n):
    lst=input().split()
    if lst[0]==lst[1] :
        out[0]+=1
        out[1]+=1
    elif lst[0]<lst[1]:
        out[1]+=3
    else : out[0]+=3

print(" ".join(map(str,out)))

Solution (Python):



n=int(input())
a=0
b=0
for i in range(n):
    A,B=map(str,input().split())
    if A > B :
        a+=3
    if A < B :
        b+=3
    if A == B :
        a+=1
        b+=1
print(a,b)

Solution (Python):
total_cards = int(input())

taro_score = 0
hanako_score = 0

for _ in range(total_cards):
    taro_card, hanako_card = input().split()
    
    if taro_card > hanako_card:
        taro_score += 3
    
    if hanako_card > taro_card:
        hanako_score += 3
    
    if hanako_card == taro_card:
        taro_score += 1
        hanako_score += 1

print(str(taro_score) + " " + str(hanako_score))

Solution (Python):
n=int(input())
a=0
b=0
for i in range(n):
    A,B=map(str,input().split())
    if A>B:
        a+=3
    if A<B:
        b+=3
    if A==B:
        a+=1
        b+=1
print(a,b)

Solution (Python):
n=int(input())
a=0
b=0
for i in range(n):
    A,B=map(str,input().split())
    if A>B:
        a+=3
    elif A==B:
        a+=1
        b+=1
    else:
        b+=3
print(a,b)

Solution (Python):
a=0
b=0
n=int(input())
for i in range(n):
    A,B=map(str,input().split())
    if A==B:
        a+=1
        b+=1
    if A<B:
        b+=3
    if B<A:
        a+=3
print(a,end=" ")
print(b)

Solution (Python):
def resolve():
    n = int(input())

    score_t = 0
    score_h = 0
    for _ in range(n):
        t, h = map(str, input().split())
        if t == h:
            score_t += 1
            score_h += 1
        if t > h:
            score_t += 3
        if h > t:
            score_h += 3
    print(score_t, score_h)


resolve()

Solution (Python):
n = int(input())
t_won = 0
h_won = 0


for i in range(n):
    t_wd,h_wd = input().split()
    if   t_wd > h_wd:
        t_won += 1
    elif t_wd < h_wd:
        h_won += 1






print(t_won*3 + (n-t_won-h_won), h_won*3 + (n-t_won-h_won))

Solution (Python):
a,b = 0,0
n = int(input())
for i in range(n):
 p1,p2 = input().split()
 if p1==p2: 
     a+=1
     b+=1
 elif p1>p2: a+=3
 else: b+=3
print(a,b)

Solution (Python):


n = int(input())
a1 = b1 = 0

for i in range(n):
    
    a,b = input().split()
    
    if a > b:
        a1 += 3
        
    elif a < b:
        b1 += 3
        
    elif a == b:
        a1 += 1
        b1 += 1
        
print(a1, b1)

Solution (Python):
n = int(input())
ts, hs = 0, 0
for i in range(n):
    t, h = input().split()
    if t > h:
        ts += 3
    elif t < h:
        hs += 3
    elif t == h:
        ts += 1; hs += 1
print(str(ts) + ' ' + str(hs))

Solution (Python):
n = int(input())
cards = [input().split() for _ in range(n)]

t = 0
h = 0

for card in cards:
    if card[0] > card[1]:
        t += 3
    elif card[0] < card[1]:
        h += 3
    else:
        t += 1
        h += 1
print(t, h)

Solution (Python):
t=h=0
for _ in[0]*int(input()):
 a,b=input().split()
 if a>b:t+=3
 if a<b:h+=3
 if a==b:t+=1;h+=1
print(t,h)

Solution (Python):
t = 0
h = 0 
n = int(input())
for i in range(n):
    a = input().split()
    if a[0] == a[1]:
        t += 1
        h += 1
    elif a == sorted(a):
        h += 3
    else:
        t += 3
print(t,h)

Solution (Python):
N, *C = open(0).read().split()
N = int(N)
a = b = 0
for i in range(0, len(C), 2):
    c1 = C[i]
    c2 = C[i+1]
    if c1 == c2:
        a += 1
        b += 1
    elif c1 > c2:
        a += 3
    else:
        b += 3
print(a, b)

Solution (Python):
n = int(input())

taro = 0
hanako = 0

for i in range(n):
    buf = input().split()
    if buf[0] > buf[1]:
        taro += 3
    elif buf[0] < buf[1]:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print("%d %d" % (taro, hanako))

Solution (Python):
n = int(input())
t = 0
h = 0
for i in range(n):
    li = [x for x in list(input().split())]
    if li[0] < li[1]:
        h += 3
    elif li[0] > li[1]:
        t += 3
    else:
        h += 1
        t += 1
print(t, h)

Solution (Python):
n = int(input())
cards = [input() for _ in range(n)]
t = 0
h = 0
for card in cards:
  c = card.split(' ')
  i = 0
  while True:
    l, r = [0, 0]
    if i < len(c[0]):
      l = ord(c[0][i])
    if i < len(c[1]):
      r = ord(c[1][i])
    if l == 0 and r == 0:
      t += 1
      h += 1
      break
    if r < l:
      t += 3
      break
    elif l < r:
      h += 3
      break
    i += 1
print("{0} {1}".format(t, h))

Solution (Python):
n=int(input())
a=0
b=0
for i in range(n):
    M,N=map(str,input().split())
    if M > N:
        a += 3
    if M < N:
        b += 3
    if M == N:
        a += 1 
        b += 1
print(a,b)

Solution (Python):
n = int(input())
taro = 0
hana = 0
for _ in range(n):
    t, h = input().split()
    if t > h:
        taro += 3
    elif t < h:
        hana += 3
    else:
        taro += 1
        hana += 1
print(taro, hana)

Solution (Python):
n = int(input())
card = [input().split() for _ in range(n)]
t = 0
h = 0
for i in range(n):
    if card[i][0] == card[i][1]:
        t += 1
        h += 1
    elif card[i][0] < card[i][1]:
        h += 3
    elif card[i][0] > card[i][1]:
        t += 3
print(f'{t} {h}')

Solution (Python):


def main():
    turns = int(input())
    animals=[]
    scores=[0,0]
    for _ in range(turns):
        animals=list(input().split())
        if animals[0]==animals[1]:
            scores[0]+=1
            scores[1]+=1
        elif  animals[0]>animals[1]:
            scores[0]+=3
        else:
            scores[1]+=3
    print(*scores)

if __name__=="__main__":
    main()