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):
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):
n = int(input())
taro, hanako = 0, 0
for _ in range(n): 
    strlist = input().split()
    if strlist[0] == strlist[1]:
        taro += 1
        hanako += 1
    else:
        sortedlist = sorted(strlist)
        if strlist == sortedlist:
            hanako += 3
        else:
            taro += 3
print(taro, hanako)

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

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

taro = 0
hanako = 0

for i in range(n):
    taro_card,hanako_card = input().split(' ')
    if taro_card > hanako_card:
        taro += 3
    elif hanako_card > taro_card:
        hanako += 3
    else:
        taro += 1
        hanako += 1
print(taro , hanako)

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

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

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

score_taro = 0
score_hanako = 0

for duel in table:
    if duel[0] > duel[1]:
        score_taro += 3
    elif duel[0] < duel[1]:
        score_hanako += 3
    else:
        score_taro += 1
        score_hanako += 1
        
print(score_taro, score_hanako)

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

Taro = []
Hanako = []

for a in range(n):
    x,y = input().split()
    Taro.append(x)
    Hanako.append(y)

point_Taro = 0
point_Hanako = 0

for a,b in zip(Taro,Hanako):
    if a<b:
        point_Hanako += 3
    elif a>b:
        point_Taro += 3
    else:
        point_Hanako += 1
        point_Taro += 1
print('{} {}'.format(point_Taro,point_Hanako))

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

Solution (Python):
num = int(input())
d = {'taro': 0,'hana': 0}
point = [0,0]
for i in range(num):
  d['taro'],d['hana'] = input().split()
  result = sorted(d.items(),key=lambda x: x[1],reverse=True)
  if result[0][1] == result[1][1]:
    point[0] += 1
    point[1] += 1
  elif result[0][0] == 'taro':
    point[0] += 3
  elif result[0][0] == 'hana':
    point[1] += 3
print(' '.join(map(str,point)))

Solution (Python):
m = int(input())
T = 0
H = 0

for i in range(m):
    arr = input().split()
    
    if arr[0] == arr[1]:
        T+=1
        H+=1
    elif sorted(arr)[0] == arr[0]: H+=3
    else: T+=3

print(T,H)

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

print(s,t)

Solution (Python):
n = int(input())
tarou_point = 0
hanako_point = 0
for _ in range(n):
    tarou_card, hanako_card = input().split()
    for i in range(len(tarou_card)):
        if ord(tarou_card[i]) > ord(hanako_card[i]):
            tarou_point += 3
            break
        elif ord(tarou_card[i]) < ord(hanako_card[i]):
            hanako_point += 3
            break
        else:
            if i == len(tarou_card) - 1 or i == len(hanako_card) - 1:
                if len(tarou_card) > len(hanako_card):
                    tarou_point += 3
                    break
                elif len(tarou_card) < len(hanako_card):
                    hanako_point += 3
                    break
                tarou_point += 1
                hanako_point += 1
print(tarou_point, hanako_point)

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:
        y+=3
    elif a==b:
        x+=1
        y+=1
    else:
        x+=3
print(x,y)

Solution (Python):
def main():
  n = int(input())
  p = [0 for _ in range(n)]

  for _ in range(n):
    taro, hanako = input().split()

    if taro > hanako:
      p[0] += 3
    elif hanako > taro:
      p[1] += 3
    else:
      p[0] += 1
      p[1] += 1

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

if __name__ == '__main__':
  main()

Solution (Python):
n = int(input())
arr = []
for i in range(0, n):
	arr.append(list(map(str, input().split())))


a, b = 0, 0
for s in arr:
	if s[0] > s[1]:
		a += 3
	elif s[0] == s[1]:
		a += 1
		b += 1
	elif s[0] < s[1]:
		b += 3

print('{0} {1}'.format(a, b))

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

Solution (Python):
n = int(input())
t_scr = 0
h_scr = 0
for _ in range(n):
    t_crd,h_crd = input().split()
    if t_crd>h_crd:
        t_scr += 3
    elif t_crd<h_crd:
        h_scr += 3
    else:
        t_scr += 1
        h_scr += 1
print(t_scr,h_scr)

Solution (Python):
N = int(input())
t_p = 0
h_p = 0

for i in range(N):
    t, h = input().split()
    if t < h:
        h_p += 3
    elif t == h:
        t_p += 1
        h_p += 1
    else:
        t_p += 3
print(t_p, h_p)

Solution (Python):
n=int(input())
tarou,hanako=0,0
for i in range(n):
    lis=list(input().split())
    lis_1=sorted(lis)
    if lis[0]==lis[1]:
        tarou+=1
        hanako+=1
    elif lis[0]==lis_1[0]:
        hanako+=3
    else:
        tarou+=3
print(str(tarou)+" "+str(hanako))

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

print(str(taro_p)+' '+str(hanako_p))

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

taro_score = 0
hanako_score = 0

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

    if taro>hanako:
        taro_score +=3
    elif taro<hanako:
        hanako_score += 3
    else:
        taro_score += 1
        hanako_score += 1
print("%d %d" % (taro_score,hanako_score))

Solution (Python):
n = int(input())
t_p = 0
h_p = 0
for i in range(n):
    t_w, h_w= input().split()
    if t_w > h_w:
        t_p += 3
    elif t_w < h_w:
        h_p += 3
    else:
        t_p += 1
        h_p += 1
print(t_p, h_p)

Solution (Python):
n = int(input())
i = 0
tp, hp = 0, 0
tc, hc = [], []

while n > i:
    tc, hc = map(str, input().split())
    if tc > hc:
        tp += 3
    elif tc < hc:
        hp += 3
    elif tc == hc:
        tp += 1
        hp += 1
    i += 1

print("{} {}".format(tp, hp))

Solution (Python):
score_t = 0
score_h = 0

n = int(input())
for _ in range(n):
    a, b = input().split()
    if a > b:
        score_t += 3
    elif b > a:
        score_h += 3
    else:
        score_t += 1
        score_h += 1

print(score_t, score_h)

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

t = 0
h = 0

for i 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):
tp = 0
hp = 0
list = []
n = int(input())
for i in range(n):
    list = input().split()
    if list[0] == list[1]:
        tp += 1
        hp += 1
    elif list[0] > list[1]:
        tp += 3
    else:
        hp += 3
    list = []

print(tp,hp)

Solution (Python):
num = int(input())
h = 0
t = 0
for n in range(num):
    str_list = input().split(" ")
    str0 = str_list[0]
    str1 = str_list[1]
    str_list.sort()
    if str1 == str0:
        h += 1
        t += 1
        continue
    else:
        if str0 == str_list[0]:
            t += 3
            continue
        elif str0 == str_list[1]:
            h += 3
            continue
print(str(h) + " " + str(t))

Solution (Python):

card_num = int(input())
Tarou_score = 0
Hanako_score = 0

for i in range(card_num):
    Tarou_card,Hanako_card = input().split()
    if Tarou_card > Hanako_card:
        Tarou_score += 3
    elif Tarou_card < Hanako_card:
        Hanako_score += 3
    else:
        Tarou_score += 1
        Hanako_score += 1

print(f'{Tarou_score} {Hanako_score}')

Solution (Python):
n = int(input())
taro =0
hanako=0
alfa='abcdefghijklmnopqrstuvwxyz'
for i in range(n):
    A,B = input().split()
    a = len(A)
    b=len(B)
    j=0
    while j<a and j<b:
        ta=alfa.find(A[j])
        ha=alfa.find(B[j])
        if ta>ha:
            taro+=3
            break
        elif ha>ta:
            hanako+=3
            break
        elif j==a-1 and j==b-1:
            taro+=1
            hanako+=1
            break
        j+=1
    else:
        if a>b:
            taro+=3
        else:
            hanako+=3
print(taro,hanako)

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

score_taro = 0
score_hanako = 0

for i in range(n):
    taro, hanako = input().split()
    if taro > hanako:
        score_taro += 3
    elif taro < hanako:
        score_hanako += 3
    else:
        score_taro += 1
        score_hanako += 1

print('{} {}'.format(score_taro, score_hanako))

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):
turn = int(input())
tarou_point = 0
hanako_point = 0
for x in range(turn):
    tarou,hanako = map(str,input().split())
    count = 0
    flg = False
    if len(tarou) >= len(hanako):
        count = len(hanako)
    else:
        count = len(tarou)

    for y in range(count):
        if ord(tarou[y:y+1]) > ord(hanako[y:y+1]):
            tarou_point += 3
            flg = True
            break
        elif ord(tarou[y:y+1]) < ord(hanako[y:y+1]):
            hanako_point += 3
            flg = True
            break
    
    if flg == False:
        if len(tarou) > len(hanako):
            tarou_point += 3
        elif len(tarou) < len(hanako):
            hanako_point += 3
        else:
            tarou_point += 1
            hanako_point += 1

print(tarou_point,end=' ')
print(hanako_point)

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

taro=0
hanako=0

for i in range(n):
    s1,s2=input().split(" ")
    if(s1<s2):
        hanako+=3
    elif(s1>s2):
        taro+=3
    else:
        taro+=1
        hanako+=1
print(taro,hanako)

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

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

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

sc_t = sc_h = 0
for i in range(n):
  t,h = input().split(" ")
  if t > h :
    sc_t += 3
  elif t < h :
    sc_h += 3
  else:
    sc_t += 1
    sc_h += 1
    
print("{} {}".format(sc_t,sc_h))

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

T = 0
H = 0

for i in range(n):
    T_card , H_card = input().split()
    if T_card == H_card :
        T += 1
        H += 1
    elif T_card > H_card :
        T += 3
    else:
        H += 3
    
print(T,H)

Solution (Python):
set_num = int(input())
list_a = []
list_b = []
for i in range(set_num):
    card_set = input().split()
    list_a.append(card_set[0])
    list_b.append(card_set[1])

a_s = 0
b_s = 0
for a_dic,b_dic in zip(list_a,list_b):
    if a_dic > b_dic:
        a_s += 3
    elif a_dic < b_dic:
        b_s += 3
    else:
        a_s += 1
        b_s += 1

print('{} {}'.format(a_s,b_s))

Solution (Python):
N = int(input())
pt_taro = 0
pt_hana = 0
for _ in range(N):
    taro, hanako = input().split()
    if taro < hanako:
        pt_hana += 3
    elif hanako < taro:
        pt_taro += 3
    elif taro == hanako:
         pt_taro += 1
         pt_hana += 1

print(pt_taro, pt_hana)

Solution (Python):
n = int(input())
t_point = 0
h_point = 0
for i in range(n):
    t_card, h_card = input().split()
    if t_card > h_card:
        t_point += 3
    elif t_card < h_card:
        h_point += 3
    else:
        t_point += 1
        h_point += 1
print(t_point, h_point)

Solution (Python):
n = int(input())
points = [0]*2

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

l = list(map(str, points))
print(" ".join(l))

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

Solution (Python):
n = int(input())
score = [0, 0]
for i in range(n):
    T, H= input().split()
    if T>H:
        score[0] += 3
    elif H>T:
        score[1] += 3
    elif T == H:
        score[0] += 1
        score[1] += 1
print (*score)

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

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

Solution (Python):
def judge(card_a, card_b):
    if card_a == card_b:
        return 1, 1
    elif card_a < card_b:
        return 0, 3
    else:
        return 3, 0


if __name__ == "__main__":
    num_turns = int(input())

    pair_cards = []

    for _ in range(num_turns):
        pair_cards.append(input().split())

    scores = list(map(lambda pair: judge(*pair), pair_cards))

    total_score = list(map(sum, zip(*scores)))

    print(' '.join(map(str, total_score)))

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

taro = 0
hanako = 0

for _ in range(n):
        words = input().split()

        w_t = words[0]
        w_h = words[1]
        flag = 0
        n = min(len(w_t),len(w_h))

        for i in range(n):
                if w_t[i] > w_h[i]:
                        taro += 3
                        flag = 1
                        break
                elif w_t[i] == w_h[i]:
                        pass
                
                else:
                        hanako += 3
                        flag = 1
                        break

        if flag == 0:
                if len(w_t) == len(w_h):
                        taro += 1
                        hanako += 1

                elif len(w_t) > len(w_h):
                        taro += 3
                else:
                        hanako += 3

        
        

print(taro,hanako)

Solution (Python):
def main():
    n = int(input())
    taro = 0
    hanako = 0
    for _ in range(0, n):
        taroCard, hanakoCard = input().split()
        if taroCard < hanakoCard:
            hanako += 3
        elif taroCard > hanakoCard:
            taro += 3
        else:
            taro += 1
            hanako += 1
    print("{0} {1}".format(taro, hanako))

if __name__ == '__main__':
    main()

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

Solution (Python):
n = input()
a_cnt = 0
b_cnt = 0
while True:
    try:
        a_order = 0
        b_order = 0
        s = list(input().split())
        if s[0] > s[1]:
            a_cnt += 3
        elif s[0] == s[1]:
            a_cnt += 1
            b_cnt += 1
        else:
            b_cnt += 3
    except EOFError:
        break

print(a_cnt,b_cnt)

Solution (Python):
n = int(input())
t = 0
h = 0
for i in range(n):
    cardt,cardh = input().split()
    if cardt == cardh:
        t += 1
        h += 1
    elif cardt > cardh:
        t += 3
    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:
        x += 3
    elif a < b:
        y += 3
    else:
        x += 1
        y += 1
print(x, y)

Solution (Python):
n = int(input())
taro = []
hanako = []

for i in range(n):
    t, h = input().split()
    taro.append(t)
    hanako.append(h)

taros_point = 0
hanakos_point = 0

for i in range(n):
    if taro[i] > hanako[i]:
        taros_point += 3
    elif taro[i] == hanako[i]:
        taros_point += 1
        hanakos_point += 1
    else:
        hanakos_point += 3

print(taros_point, hanakos_point)

Solution (Python):
taro_point = 0
hanako_point = 0

n = int(input())
for i in range(n):
    taro, hanako = input().split()
    if taro == hanako:
        taro_point += 1
        hanako_point += 1
    elif taro > hanako:
        taro_point += 3
    else:
        hanako_point += 3
print(taro_point, hanako_point)

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

taro, hanako = 0, 0
for match in cards:
    if match[0] > match[1]:
        taro += 3
    elif match[0] < match[1]:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro, hanako)

Solution (Python):
N=int(input())
points1=0
points2=0
for i in range(N):
    card1,card2=input().split()
    if card1==card2:
        points1+=1
        points2+=1
        continue
    M=min(len(card1),len(card2))
    c=""
    d=""
    for j in range(M):
        c+=card1[j]
        d+=card2[j]
    if c==d and len(card1)>len(card2):
        points1+=3
        continue
    elif c==d and len(card1)<len(card2):
        points2+=3
        continue
    for j in range(M):
        a=card1[j]
        b=card2[j]
        if a>b:
            points1+=3
            break
        elif a<b:
            points2+=3
            break
        elif a==b:
            continue
print(points1,points2)

Solution (Python):
scores = [0, 0]
for i in range(int(input())):
    cards = input().split()
    if cards[0] == cards[1]:
        scores = [score+1 for score in scores]

    else:
        sorted_cards = sorted(cards)
        if sorted_cards == cards:
            scores[1] += 3
        else:
            scores[0] += 3

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

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):
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):
out = [0, 0]

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

print(*out)

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

Solution (Python):
n = int(input())
score_taro = 0
score_hanako = 0
for i in range(n):
    animal_taro, animal_hanako = input().split()
    if animal_taro < animal_hanako:
        score_hanako += 3
    elif animal_taro == animal_hanako:
        score_taro += 1
        score_hanako += 1
    else:
        score_taro += 3
print(f"{score_taro} {score_hanako}")

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

Solution (Python):
n = int(input())
score_set = [0, 0]

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

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

Solution (Python):



n = int(input())


taro_score = 0
hanako_score = 0


for i in range(n):
    taro, hanako = input().split()
    if taro>hanako:
        taro_score += 3
    elif taro<hanako:
        hanako_score += 3
    else:
        taro_score += 1
        hanako_score += 1


print("%d %d"%(taro_score, hanako_score))

Solution (Python):
a,b=0,0
for i in [0]*int(input()):
  A,B = input().split()
  if A>B:a += 3
  elif B>A:b += 3
  else:a +=1;b += 1
print(str(a)+" "+str(b))

Solution (Python):
n = int(input())
i=0
T_point=H_point=0
while i < n:
    Taro_card, Hana_card = list(input().split())
    if Taro_card>Hana_card:
        T_point+=3
    elif Taro_card==Hana_card:
        T_point+=1
        H_point+=1
    else:
        H_point+=3
    i+=1

print(T_point, H_point)

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

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

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

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

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


if __name__ == '__main__':
    main()

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

print(taro,hanako)

Solution (Python):
n = int(input())
versus = []
T_point = 0
H_point = 0

for i in range(n):

    Taro, Hanako = input().split()
    
    versus.append(Taro)
    versus.append(Hanako)
    
    versus.sort()
    
    if Hanako == Taro == versus[0]:
        T_point += 1
        H_point += 1
    
    elif versus[0] == Taro:
        H_point += 3
        
    else:
        T_point += 3
        
    versus.clear()
    
print(f"{T_point} {H_point}")

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

Solution (Python):
l="abcdefghijklmnopqrstuvwxyz"
a,b=0,0
s=int(input())
for _ in range(s):
    t,h=input().split()
    for n in range(min(len(t),len(h))):
        t_=l.find(t[n])
        h_=l.find(h[n])
        if t_>h_:
            a+=3
            break
        elif t_<h_:
            b+=3
            break
        elif n ==min(len(t),len(h))-1:
            if len(t)==len(h):
                a+=1
                b+=1
            elif len(t)>len(h):
                a+=3
            elif len(t)<len(h):
                b+=3
print(a,b)

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

tarou = 0
hanako = 0
for i in range(num):
  s = input().rstrip().split(' ')
  taroucard = str(s[0])
  hanakocard = str(s[1])
  if taroucard > hanakocard:
    tarou += 3
  elif taroucard == hanakocard:
    tarou += 1
    hanako += 1
  elif taroucard < hanakocard:
    hanako += 3
print(str(tarou) + " " + str(hanako))

Solution (Python):
n = int(input())
num_t, num_h = 0, 0

for _ in range(n):
    card = input().split()
    if card[0] == card[1]:
        num_t += 1
        num_h += 1
    elif card[0] > card[1]:
        num_t += 3
    else:
        num_h += 3

print(num_t, num_h)

Solution (Python):
ts = 0
hs = 0
for i in range(int(input())):
	t,h = input().split()
	if t < h:
		hs+=3
	elif t > h:
		ts+=3
	else:
		ts+=1
		hs+=1
print(f"{ts} {hs}")

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

score_a = 0
score_b = 0

for i in range(n):
        a, b = input().split()
        if a > b:
            score_a += 3
        elif a < b:
            score_b += 3
        else:
            score_a += 1
            score_b += 1

print(score_a, score_b)

Solution (Python):
tarop, hanakop = 0, 0
n = int(input())

for i in range(n):
    taroc, hanakoc = input().split()
    if taroc > hanakoc:
        tarop += 3
    elif taroc < hanakoc:
        hanakop += 3
    elif taroc == hanakoc:
        tarop += 1
        hanakop += 1

print(tarop, hanakop)

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

taro = 0
hanako = 0

for i in range(n):
    taro_card = card[i][0]
    hanako_card = card[i][1]
    
    if taro_card == hanako_card:
        taro += 1
        hanako += 1
        continue
    if taro_card > hanako_card:
        taro += 3
    else:
        hanako += 3
    
print(taro, hanako)

Solution (Python):
import math
import copy
from copy import deepcopy
import sys
import fractions

from functools import reduce

import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)







def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




n = int(input())
ans_a = 0
ans_b = 0

for i in range(n):
    a, b = input().split()
    if a > b:
        ans_a += 3
    elif b > a:
        ans_b += 3
    else:
        ans_a += 1
        ans_b += 1

print(ans_a, ans_b)

Solution (Python):
turn = int(input())
taropt = 0
hanapt=0
for i in range(turn):
    [taro, hanako] = input().split()
    if taro > hanako:
        taropt+=3
    elif taro < hanako:
        hanapt+=3
    else:
        taropt += 1
        hanapt+=1

print("{} {}".format(taropt,hanapt))

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    ans = [0, 0]
    for i in range(N):
        s = input().strip().split()
        if s[0] == s[1]:
            ans[0] += 1
            ans[1] += 1
        elif s[0] > s[1]:
            ans[0] += 3
        else:
            ans[1] += 3
    
    print(ans[0], ans[1])



if __name__ == "__main__":
    main()

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

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

Solution (Python):
n = int(input())
pair_list = list()
for i in range(n):
    pair = list(map(str,input().split()))
    pair_list.append(pair)

a = 0
b = 0
for card in pair_list:
    if card[0] == card[1]:
        a += 1
        b += 1
        continue

    if card == sorted(card):
        b += 3
    else:
        a += 3

print(a,b)

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

point_t = 0
point_h = 0
for i in range(N):
    t, h = input().split()
    if t > h:
        point_t += 3
    elif t < h:
        point_h += 3
    else:
        point_t += 1
        point_h += 1  

print(point_t, point_h)

Solution (Python):
taro = 0
hanako = 0
for i in range(int(input())):
    line = str(input()).split()
    t = line[0]
    h = line[1]
    if (t == h):
        taro += 1
        hanako += 1
    elif (t < h):
        hanako += 3
    elif (t > h):
        taro += 3

print('{} {}'.format(taro, hanako))

Solution (Python):

turn = int(input())
s = 0
t = 0

for i in range(turn):
    a,b = map(str,input().split())
    if a > b :
        s += 3
    elif a < b:
        t += 3
    elif a == b:
        s += 1
        t += 1
print(s,t)

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

print(p,q)

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

print("{0} {1}".format(c1,c2))

Solution (Python):
N = int(input())
ans = [0, 0]
for _ in range(N):
    t, h = input().split()
    if t < h:
        ans[1] += 3
    elif t > h:
        ans[0] += 3
    else:
        ans[0] += 1
        ans[1] += 1
print(*ans)

Solution (Python):
n = int(input())
battle = [input().split(" ") for i in range(n)]
result = [0] * 2
for i in battle:
  taro = i[0]
  hanako = i[1]

  if taro > hanako:
    result[0] += 3
  elif taro < hanako:
    result[1] += 3
  else:
    result[0] += 1
    result[1] += 1
print("{} {}".format(result[0], result[1]))