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):

num = int(input())
result = {'taro':0, 'hanako':0}
for i in range(num):
    cards = input().split()
    taro = cards[0]
    hanako = cards[1]
    sorted_cards = sorted(cards)
    if taro == hanako:
        result['taro'] += 1
        result['hanako'] += 1
    elif cards == sorted_cards:
        result['hanako'] += 3
    else :
        result['taro'] += 3
print(result['taro'], result['hanako'])

Solution (Python):
n = int(input())
points = [0, 0]
for i in range(n):
    cards = input().split()
    c0, c1 = len(cards[0]), len(cards[1])
    c = min(c0, c1)
    for i in range(c):
        if cards[0][i] > cards[1][i]:
            points[0] += 3
            break
        elif cards[0][i] < cards[1][i]:
            points[1] += 3
            break
    else:
        if c0 > c1:
            points[0] += 3
        elif c0 < c1:
            points[1] += 3
        else:
            points[0] += 1
            points[1] += 1
print(points[0], points[1])

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

Solution (Python):
n = int(input())
tscore = 0
hscore = 0

for i in range(n):
    t, h = map(str, input().split())

    if t > h:
        tscore += 3
    elif t < h:
        hscore += 3
    else:
        tscore += 1
        hscore += 1

print(tscore, hscore)

Solution (Python):
n = int(input())
result = [0]*2
for i in range(n):
    s = input().strip().split()
    ss = sorted(s)
    if s[0] == s[1]:
        result[0] += 1
        result[1] += 1
    elif s[1] == ss[0]:
        result[0] += 3
    elif s[1] == ss[1]:
        result[1] += 3
        
print('{} {}'.format(result[0],result[1]))

Solution (Python):




tpt = hpt = 0
n = int(input())

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

Solution (Python):
n = int(input())
ans_taro = 0
ans_hanako = 0

for i in range(n):
  c_taro, c_hanako = input().split()
  if c_taro > c_hanako:
    ans_taro += 3
  elif c_taro == c_hanako:
    ans_taro += 1
    ans_hanako += 1
  else:
    ans_hanako += 3

print('%d %d' %(ans_taro, ans_hanako))

Solution (Python):
class Type:
    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())
taro_point=0
hanako_point=0
for i in range(N):
  taro,hanako=input().split()
  if taro < hanako:
    hanako_point+=3
  elif taro == hanako:
    taro_point +=1
    hanako_point +=1
  else:
    taro_point +=3

print(taro_point,hanako_point)

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

p1 = 0
p2 = 0

for i in range(n):
        str = input()
        i = str.find(" ")
        str1 = str[: i]
        str2 = str[i+1 :]

        if str1 > str2:
                p1 += 3
        elif str1 < str2:
                p2 += 3
        else:
                p1 += 1
                p2 += 1
        
print("%d %d" % (p1, p2))

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

point_t = 0
point_h = 0
for i in range(n):
    taro, hanako = input().split()
    if taro > hanako:
        point_t += 3
    elif taro < hanako:
        point_h += 3
    elif taro == hanako:
        point_t += 1
        point_h += 1
print(point_t,point_h)

Solution (Python):
N = int(input())
taro = 0
hanako = 0

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

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

Solution (Python):
n = int(input())
taro = 0
hana = 0
for i in range(n):
    list1 = list(map(str, input().split()))
    if list1[0] == list1[1]:
        taro += 1
        hana += 1
    elif list1 == sorted(list1):
        hana += 3
    else:
        taro += 3
print(str(taro) + " " + str (hana))

Solution (Python):
num_t = int(input())
T_point = 0
H_point = 0
for i in range(num_t):
    TH = input()
    TH_list = TH.split(" ")
    if TH_list[0] > TH_list[1]:
        T_point += 3
    elif TH_list[0] < TH_list[1]:
        H_point += 3
    else:
        T_point += 1
        H_point += 1
print(str(T_point) + " " + str(H_point))

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

Solution (Python):
t = 'taro'
h = 'hanako'
score = { t: 0, h: 0}

n = int(input())

for _ in range(n):
    ls = input().split()
    
    t_card = ls[0]
    h_card = ls[1]
    
    new_ls = sorted(ls)
    if t_card == h_card:
        score[t] += 1
        score[h] += 1
    elif t_card == new_ls[0]:
        score[h] += 3
        
    elif h_card == new_ls[0]:
        score[t] += 3
    
print(score[t], score[h])

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

Solution (Python):
n = int(input())
p1 = 0
p2 = 0
for i in range(n):
    k , p = input().split()
    z = 0
    if k == p:
        p1,p2 = p1+1,p2+1
        continue
    elif len(k) <len(p):
        z = len(k)
    else:
        z = len(p)
    for i in range(z):
        if ord(k[i])<ord(p[i]):
           p2 += 3
           break
        elif ord(k[i])>ord(p[i]):
           p1 += 3
           break
    else:
        if len(k) < len(p):
            p2 +=3
        else:
            p1 +=3

print("%d %d" %(p1,p2))

Solution (Python):
h = 0
t = 0

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

Solution (Python):
pts = [0, 0]
for _ in range(int(input())):
  a, b = input().split()
  if a > b:
    pts[0] += 3
  elif a < b:
    pts[1] += 3
  else:
    pts[0] += 1
    pts[1] += 1

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

Solution (Python):
Taro = 0
Hanako = 0

n = int(input())
for i in range(n):
  T_card, H_card = input().split()
  if T_card > H_card:
    Taro += 3
  elif T_card < H_card:
    Hanako += 3
  else:
    Taro += 1
    Hanako += 1

print(Taro,Hanako)

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

taro =[]
hanako=[]
for i in range(N):
    columns = list(input().split())
    taro.append(columns[0])
    hanako.append(columns[1])

taroScore = 0
hanakoScore = 0

for t, h in zip(taro, hanako):
    if t > h:
        taroScore += 3
    elif t == h:
        taroScore +=1
        hanakoScore +=1
    else:
        hanakoScore +=3
print(taroScore, hanakoScore, sep=" ")

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

Solution (Python):
n=int(input())
tc = 0
hc = 0
for _ in range(0,n):
    t,h = input().split()
    if t > h: tc = tc + 3
    if t < h: hc = hc + 3
    if t == h: 
        tc = tc + 1
        hc = hc + 1
print('{0} {1}'.format(tc, hc))

Solution (Python):

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

print(str(taro) + " " + str(hanako))

Solution (Python):
taro = 0
hanako = 0
nums = int(input())

for _ in range(nums):
    t, h = input().split()
    if t > h:
        taro += 3
    elif t < h:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro, hanako)

Solution (Python):
cardNumber = int(input())
Taro = 0
Hanako = 1
TaroScore = 0
HanakoScore = 0
winIndex = 0

for drawNumber in range(cardNumber):
    card = input().split(" ")
    sortedCard = sorted(card, reverse=True)
    winCard = card[card.index(sortedCard[winIndex])]
    if card[Taro] == winCard and card[Hanako] == winCard:
        TaroScore += 1
        HanakoScore += 1
    elif card[Taro] == winCard and card[Hanako] != winCard:
        TaroScore += 3
    elif card[Taro] != winCard and card[Hanako] == winCard:
        HanakoScore += 3
print("%d %d" %(TaroScore,HanakoScore))

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

Solution (Python):
n = int(input())
Tpoint = 0
Hpoint = 0
for i in range(n):
    Taro ,Hanako = map(str,input().split())

    if Taro<Hanako:
        Tpoint+=0
        Hpoint+=3
    elif Taro==Hanako:
        Tpoint+=1
        Hpoint+=1
    else:
        Tpoint+=3
        Hpoint+=0
print(Tpoint,Hpoint)

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

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

for i in range(n):
    a = input().split()
    if a[0] > a[1] :
        result[0] += 3
    if a[0] < a[1] :
        result[1] += 3
    if a[0] == a[1] :
        result[0] += 1
        result[1] += 1

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

Solution (Python):
def check(left, right):
    if left == "" and right == "":
        return 1, 1
    elif left == "":
        return 0, 3
    elif right == "":
        return 3, 0

    l_c = ord(left[0])
    r_c = ord(right[0])
    if l_c < r_c:
        return 0, 3
    elif l_c > r_c:
        return 3, 0
    else:
        return check(left[1:], right[1:])


n = int(input())
l_p = 0
r_p = 0
for x in range(n):
    left, right = input().split()
    tmp = check(left, right)
    l_p += tmp[0]
    r_p += tmp[1]
print(l_p, r_p)

Solution (Python):
n = int(input())
taro = 0
hanako = 0
for i in range(n):
    vs = list(input().split())
    if vs[0] == vs[1]:
        taro+=1
        hanako+=1
        continue
    short = min(len(vs[0]), len(vs[1]))
    if vs[0][:short] == vs[1][:short]:
        if len(vs[0]) == short:
            hanako += 3
        else:
            taro += 3
        continue
    for j in range(short):
        if ord(vs[0][j]) < ord(vs[1][j]):
            hanako += 3
            break
        elif ord(vs[0][j]) > ord(vs[1][j]):
            taro += 3
            break
print(str(taro) + " " + str(hanako))

Solution (Python):
taroScore = 0
hanakoScore = 0
num = int(input())
for i in range(num):
        list = input().split()
        taroStr = list[0]
        hanakoStr = list[1]
        if taroStr > hanakoStr:
                taroScore += 3
        elif taroStr < hanakoStr:
                hanakoScore += 3
        else:
                taroScore += 1
                hanakoScore += 1

print(taroScore, hanakoScore)

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())
taro = 0
hanako = 0
for _ in range(n):
    t,h = input().split()
    if t == h:
        taro += 1
        hanako += 1
    elif t < h:
        hanako += 3
    else:
        taro += 3
print("%i %i" % (taro, hanako))

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

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

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

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

A = 0
B = 0

for i in range(n):
    a, b = input().split()

    if a > b:
        A += 3
    elif b > a:
        B += 3
    else:
        A += 1
        B += 1

print(A, B)

Solution (Python):
t = 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):
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_a += 1
        score_b += 1
    else:
        score_b += 3
print(score_a, score_b)

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

Solution (Python):
n=int(input())
x,y=0,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):
import sys

points = [0, 0]

turns = int(sys.stdin.readline())
for _ in range(turns):
    w1, w2 = sys.stdin.readline().strip().split()
    if w1 > w2:
        points[0] += 3
    elif w2 > w1:
        points[1] += 3
    else:
        points[0] += 1
        points[1] += 1

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

Solution (Python):
cnt=int(input())
taro,hanako=0,0

for i in range(cnt):
    A,B=input().split()
    if A>B:
        taro+=3
    elif B>A:
        hanako+=3
    else:
        hanako+=1;taro+=1
print(taro,hanako)

Solution (Python):
n = int(input())
taro_p, hanako_p = 0, 0
for i in range(n):
    taro, hanako = input().split()
    x, y = [(3,0), (1,1), (0,3)][(taro < hanako) + (taro <= hanako)]
    taro_p += x
    hanako_p += y
print(taro_p, hanako_p)

Solution (Python):
def main():
	n = int(input())
	pointTaro = 0
	pointHanako = 0
	for i in range(n):
		l = input().split()
		if l[0] > l[1]:
			pointTaro += 3
		elif l[0] == l[1]:
			pointTaro += 1
			pointHanako += 1
		else:
			pointHanako += 3
	print(pointTaro, pointHanako)

main()

Solution (Python):
n = int(input())
t = 0
h = 0

for _ in range(n):
    tc, hc = input().split()

    if tc > hc:
        t += 3
    elif tc < hc:
        h += 3
    else:
        t += 1
        h += 1

print(t, h)

Solution (Python):
maisu=int(input())
taro_tokuten=0
hanako_tokuten=0

for i in range(maisu):
    huda=list(map(str,input().split()))
    taro=huda[0]
    hanako=huda[1]
    if taro>hanako:
        taro_tokuten+=3
    elif taro<hanako:
        hanako_tokuten+=3
    else:
        taro_tokuten+=1
        hanako_tokuten+=1

print(str(taro_tokuten)+" "+str(hanako_tokuten))

Solution (Python):
s1=s2=0
n = int(input())
while ( n > 0 ):
    n = n -1
    (a,b)  =  map(str,input().split())

    if (a > b):
        s1 += 3
    elif (b > a):
        s2 += 3
    else:
        s1 += 1
        s2 += 1
print (s1,s2)

Solution (Python):
def cardFight(taro, hanako):
    if taro < hanako:
        return 0, 3
    elif taro == hanako:
        return 1, 1
    else:
        return 3, 0

if __name__ == '__main__':
    taroP, hanakoP = 0, 0
    m = int(input())
    for i in range(m):
        t, h = input().split()
        tP, hP = cardFight(t, h)
        taroP += tP
        hanakoP += hP
    print(taroP, hanakoP)

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

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

tlist = []
hlist = []

for _ in range(n):
    clist = list(map(str, input().split()))
    tlist.append(clist[0])
    hlist.append(clist[1])

tscore = 0
hscore = 0

for t, h in zip(tlist, hlist):
    if t > h:
        tscore += 3
    elif t == h:
        tscore += 1
        hscore += 1
    else:
        hscore += 3

print(tscore, hscore)

Solution (Python):
n = int(input())
taro   = 0
hanako = 0

for _ in range(n):
    t,h = input().split()
    if   t > h:
        taro   += 3
    elif t < h:
        hanako += 3
    elif t == h:
        taro   += 1
        hanako += 1
print('{} {}'.format(taro,hanako))

Solution (Python):
n=int(input())
t_p=0
h_p=0
for i in range(0,n):
    Taro,Hana = input().split()
    if(Taro==Hana):
        t_p+=1
        h_p+=1
    elif(Taro > Hana):
        t_p+=3
    else:
        h_p+=3
print(f"{t_p} {h_p}")

Solution (Python):
print(*[sum(x)for x in zip(*[[3,0]if a>b else[0,3]if a<b else[1,1]for a,b in[input().split()for i in[0]*int(input())]])])

Solution (Python):
card_n = int(input())
A = 0
B = 0
for i in range(card_n):
    Acard, Bcard = input().split()
    if Acard == Bcard:
        A += 1
        B += 1
    else:
        for a, b in zip(Acard, Bcard):
            if ord(a) > ord(b):
                A += 3
                break
            elif ord(a) < ord(b):
                B += 3
                break
            elif a == Acard[-1] or b == Bcard[-1]:
                if len(Acard) > len(Bcard):
                    A += 3
                else:
                    B += 3
print(A, B)

Solution (Python):
num=int(input())
H=0
T=0
for i in range(num):
	a=input().split()
	if a[0]<a[1]:
		T+=3
	elif a[1]<a[0]:
		H+=3
	else:
		T+=1
		H+=1
print(str(H)+' '+str(T))

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

Solution (Python):
n = int(input())
taro = 0
hana = 0
s=[]
ss=[]

for i in range(n):
    s = list(map(str, input().split()))
    
    ss = sorted(s)
    

    if s[0] == s[1]:
        taro += 1
        hana += 1
    elif s == ss:
        hana += 3
    else:
        taro += 3
    

print("{} {}".format(taro, hana))

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

Taro = 0
Hanako = 0

for n in range(0, round_n):
    _in = input().split()
    if (_in[0] > _in[1]):
        Taro += 3
    elif (_in[0] < _in[1]):
        Hanako += 3
    else :
        Taro += 1
        Hanako += 1

print(str(Taro) + ' ' + str(Hanako))

Solution (Python):
n = int(input())
listA = []
listB = []
pntA = pntB = 0 

for i in range(n):
    A, B = map(str, input().split())
    listA.append(A)
    listB.append(B)

    if listA[i] > listB[i]:
        pntA += 3
    elif listA[i] == listB[i]:
        pntA += 1
        pntB += 1
    else:
        pntB += 3

print(str(pntA) + ' ' + str(pntB))

Solution (Python):
n=int(input())
taro=0; hanako=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(str(taro)+" "+str(hanako))

Solution (Python):



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

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

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

print(taro, hanako)

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())
t = 0
h = 0
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):
T=0
H=0
n=int(input())
for i in range(n):
    s=input()
    s=s.rstrip().split()
    if s[0]==s[1]:
        T+=1
        H+=1
    else:
        t=[s[0],"t"]
        h=[s[1],"h"]
        S=[t,h]
        S.sort()
        if S[1][1]=="t":
            T+=3
        elif S[1][1]=="h":
            H+=3
print(T,H)

Solution (Python):



points = {
    'taro': 0, 
    'hanako':0
}

loops = int(input())

for _ in range(loops):
    c_taro, c_hanako = map(str, input().split())
    if c_taro < c_hanako:
        points['hanako'] += 3
    elif c_taro > c_hanako:
        points['taro'] += 3
    else:
        points['hanako'] += 1
        points['taro'] += 1

print(points['taro'], points['hanako'])

Solution (Python):
n = int(input())
t = 0
h = 0

for _ in range(n):
    tc, hc = input().split()

    if tc > hc:
        t += 3
    elif tc < hc:
        h += 3
    else:
        t += 1
        h += 1

print(t, h)

Solution (Python):


if __name__ == '__main__':
    point = [0]*2
    n = int(raw_input())

    for _ in range(n):
        t, h = raw_input().split()
        if t == h:
            point = map(lambda x: x+1, point)
        else:
            point[t<h] += 3

    print '%d %d' % tuple(point)

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

Solution (Python):
n = int(input())
pt = 0
ph = 0
for _ in range(n):
	t,h = map(str, tuple(input().split(' ')))
	if t > h: pt += 3
	elif h > t: ph += 3
	elif t == h:
		pt += 1
		ph += 1
print(pt,ph)