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=0;hanako=0
for i in range(int(input())):
    l=list(map(str,input().split()))
    if l[0]>l[1]:
        taro+=3
    elif l[0]<l[1]:
        hanako+=3
    else:
        taro+=1;hanako+=1
print(taro,hanako)

Solution (Python):
t = 0
h = 0
for _ in range(int(input())):
    n = list(input().split())
    if n[0] > n[1]:
        t += 3
    elif n[1] > n[0]:
        h += 3
    else:
        t += 1
        h += 1
print("%d %d" % (t, h))

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

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

p = [0, 0]

for i in range(num):
    list = input().split()
    if list[0] == list[1]:
        p[0] += 1
        p[1] += 1
    elif sorted(list)[0] == list[0]:
        p[1] += 3
    else:
        p[0] += 3

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

Solution (Python):
n = int(input())
cnt_a = 0
cnt_b = 0
for i in range(n):
	list = input().split()
	list_sorted=sorted(list)
	if list[0]==list[1]:
		cnt_a +=1
		cnt_b +=1
	elif list[0] == list_sorted[1]:
		cnt_a +=3
	elif list[0] == list_sorted[0]:
		cnt_b +=3
print("{} {}".format(cnt_a,cnt_b))

Solution (Python):
from itertools import zip_longest
n = int(input())
c = [0]*2
for _ in range(n):
    s = input().split()
    for a, b in zip_longest(s[0], s[1], fillvalue='`'):
        if ord(a) > ord(b):
            c[0] += 3
            break
        if ord(a) < ord(b):
            c[1] += 3
            break
    if ord(a) == ord(b):
        c[0] += 1;c[1] += 1

print(*c)

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

str="abcdefghijklmnopqrstuvwxyz"
char=[]
for i in range(26):
    char.append(str[i])

index=[i for i in range(26)]


alphabet=dict(zip(char,index))


Taro=0
Hanako=0
for i in range(n):
    s = input().split()
    str1 = s[0]
    str2 = s[1]



    len1=len(str1)
    len2=len(str2)
    if len1>len2:
        for i in range(len2):
            if alphabet[str1[i]]>alphabet[str2[i]]:
                Taro+=3
                break
            elif alphabet[str1[i]]<alphabet[str2[i]]:
                Hanako+=3
                break
            elif i==len2-1:
                Taro+=3
    elif len1<len2:
        for i in range(len1):
            if alphabet[str1[i]]>alphabet[str2[i]]:
                Taro+=3
                break
            elif alphabet[str1[i]]<alphabet[str2[i]]:
                Hanako+=3
                break
            elif i==len1-1:
                Hanako+=3
    else:
        for i in range(len1):
            if alphabet[str1[i]]>alphabet[str2[i]]:
                Taro+=3
                break
            elif alphabet[str1[i]]<alphabet[str2[i]]:
                Hanako+=3
                break
            elif alphabet[str1[i]]==alphabet[str2[i]] and i==len1-1:
                Taro+=1
                Hanako+=1
    

print(Taro,Hanako)

Solution (Python):


ta = 0
ha = 0
n = int(input())
for i in range(n):
    names = list(map(str, input().split()))
    if names[0] == names[1]:
        ta += 1
        ha += 1
    else:
        sorted_n = sorted(names)
        if names[0] == sorted_n[0]:
            ha += 3
        else:
            ta += 3
print(ta, ha)

Solution (Python):
def test():

	n = int(input())

	Taro = 0
	Hanako = 0

	for i in range(n):

		cards = input().split()

		cards[0] = cards[0].upper()
		cards[1] = cards[1].upper()
		
		if cards[0] == cards[1]:
			Taro += 1
			Hanako += 1
		elif cards[0] > cards[1]:
			Taro += 3
		else:
			Hanako += 3
		
	print(f"{Taro} {Hanako}")

if __name__ == "__main__":
	test()

Solution (Python):

taro = 0
hanako = 0

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

print(taro, hanako)

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

for _ in range(n):
    a, b = input().split()
    if a == b:
        h += 1; t += 1
    elif a < b:
        t += 3
    else:
        h += 3

print(h, t)

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

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

import sys
s = [0, 0]
while True:
    line = sys.stdin.readline() 
    if not line: break 
    line = line.rstrip('\r\n') 
    if line.isdigit():
        next
    else:
        words = line.split()
        if words[0] < words[1]:
            s[1] += 3
        elif words[0] > words[1]:
            s[0] += 3
        else:
            s[0] += 1
            s[1] += 1
print(s[0], s[1])

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

pa, pb = 0, 0
for a, b in X:
    if a > b:
        pa += 3
    elif a < b:
        pb += 3
    else:
        pa += 1
        pb += 1
print(pa, pb)

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

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_won=0
h_won=0
for _ 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):
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):
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):
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())
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):
t = h = 0
for i in range(int(input())):
    s = input()
    a, b = s.split()
    if a == b:
        t += 1; h += 1
    elif a > b:
        t += 3
    else:
        h += 3
print(t, h)

Solution (Python):
n = int(input())
Taro_score = 0
Hanako_score = 0
for i in range(n):
    wlist = []
    t,h = map(str, input().split())
    wlist.append(t)
    wlist.append(h)
    order = sorted(wlist, key = str.lower)
    if (t.lower() == h.lower()):
        Taro_score += 1
        Hanako_score += 1
    elif (order[1] == t):
        Taro_score += 3
    elif (order[1] ==h ):
        Hanako_score += 3
print(Taro_score, Hanako_score)

Solution (Python):
n = int(input())
s_taro,s_hanako = 0,0

for trial in range(n):
  taro,hanako = list(map(str,input().split()))
  if taro > hanako:
    s_taro += 3
  elif taro < hanako:
    s_hanako += 3
  else:
    s_taro += 1
    s_hanako +=1
print(s_taro,s_hanako)

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

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

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

taro, hanako = 0, 0
for g in G:
	if g[0] < g[1]:
		hanako += 3
	elif g[0] > g[1]:
		taro += 3
	else:
		hanako += 1
		taro += 1
print(taro, hanako)

Solution (Python):
n = 0
n = int(input())
ls = []
for i in range(n):
    x = list(input().split())
    ls.append(x)

score1 = 0;score2 = 0
for i in range(n):
    s1 = ls[i][0];s2 = ls[i][1]
    if s1==s2:
        score1 += 1;score2 += 1
        continue
    len1,len2 = len(s1),len(s2)
    flag = 0
    for i in range(min(len1,len2)):
        if s1[i] > s2[i]:
            flag = 1 
            score1 += 3
            break;
        elif s1[i] < s2[i]:
            flag = 1
            score2 += 3
            break
    if flag == 0 and len1!=len2:
        if len1>len2:
            score1 += 3
        else:
            score2 += 3
    
print(score1,score2)

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

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

Solution (Python):
num=int(input())
taro_point=hanako_point=0

for n in range(num):
  taro_card,hanako_card = input().split()
  min_cards_num=min(len(taro_card),len(hanako_card))
  
  if taro_card==hanako_card:
    taro_point+=1
    hanako_point+=1
  else:
    for c in range(min_cards_num):
      if taro_card[c]<hanako_card[c] :
        hanako_point+=3
        
        break
      elif(taro_card[c]>hanako_card[c]):
        taro_point+=3
        
        break
      
      elif c == min_cards_num -1:
        
        if len(hanako_card)>len(taro_card):
          hanako_point+=3
          
        else:
          taro_point+=3
          

print(taro_point,hanako_point)

Solution (Python):
n = int(input())
tp = 0
hp = 0

for i in range(n):
    tw, hw = input().split()
    if tw > hw:
        tp += 3
    elif hw > tw:
        hp += 3
    else:
        tp += 1
        hp += 1
print(tp,hp)

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

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):
s = t = 0
for _ in range(int(input())):
  a, b = input().split()
  if a > b:
    s += 3
  elif a < b:
    t +=  3
  else:
    s += 1;t += 1
print(s, t)

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())
taro = 0
hana = 0

for i in range(n):
  tc, hc = input().split()
  
  if tc > hc:
    taro += 3
  elif tc < hc:
    hana += 3
  else:
    taro += 1
    hana += 1
    
print(taro, hana)

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

tlist = [] 
hlist = [] 

for _ in range(n):
  a = list(map(str, input().split()))
  tlist.append(a[0])
  hlist.append(a[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):
point = [0,0]
card = ["",""]
n=int(input())
for i in range(n):
    card = input().split()
    if card[0]==card[1]:
        point[0]+=1
        point[1]+=1
    elif card==sorted(card):
        point[1]+=3
    else:
        point[0]+=3
print("{} {}".format(point[0],point[1]))

Solution (Python):

 



 
import sys
import math
 

class mymath:
    
    pi = 3.14159265358979323846264338
 
    
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []
 
        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist
 
    
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)
 
    
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)
 
    
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans
 
mymath = mymath()
 

class output:
    
    def list(self, l):
        l = list(l)
        
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()
 
output = output()
 






 


 


 


 





def get_input():
  N = []
  while True:
    try:
      N.append(input())
      
    except EOFError:
      break
  return N


N = int(input())
W = []

a = 0
b = 0

for i in range(N):
  W.append([x for x in input().split()])
  
for aw, bw in W:
  if aw == bw:
    a += 1
    b += 1
  elif aw > bw:
    a += 3
  else:
    b += 3
    
print(a,b,sep=' ')

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

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

taro = 0
hanako = 0

for _ in range(n):
    left, right = input().split()

    if left > right:
        taro += 3
    elif left < right:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro, hanako)

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):
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())
t_won=0
h_won=0
for _ 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):
n=int(input())
t_won=0
h_won=0
for _ 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):
n=int(input())
t_won=0
h_won=0
for _ 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):
n=int(input())
t_won=0
h_won=0
for _ 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):
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("%d %d" %(taro, hanako))

Solution (Python):
N=int(input())
Taro=0
Hanako=0
for i in range(N):
    str=list(input().split())
    if str[0]>str[1]:
        Taro+=3
    elif str[0]<str[1]:
        Hanako+=3
    else:
        Taro+=1
        Hanako+=1
print(f'{Taro} {Hanako}')

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

Solution (Python):
if __name__ == "__main__":
    scores = [0, 0]
    turn_num = int(input())
    for turn in range(turn_num):
        cards = input().split()
        if cards[0] == cards[1]:
            scores[0] += 1
            scores[1] += 1
        elif cards[0] > cards[1]:
            scores[0] += 3
        else:
            scores[1] += 3
    print(f"{scores[0]} {scores[1]}")

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

Solution (Python):
t = 0
h = 0

num = input()
i = 0
while i < num:
    animals = raw_input().split()
    if animals[0] < animals[1]:
        h += 3
    elif animals[0] > animals[1]:
        t += 3
    else:
        t += 1
        h += 1
    i += 1

print t,h

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

taro_list=[]
hana_list=[]
alfa = list('abcdegfhijklmnopqrstuvwxyz')

while n>0:
  taro, hana = map(str,input().split())
  taro_list.append(taro)
  hana_list.append(hana)
  n = n - 1

a=0
b=0
for (ta, ha) in zip (taro_list, hana_list):
  if ta > ha:
    a = a + 3
  elif ta < ha:
    b = b + 3
  else:
    a = a + 1
    b = b + 1
    
print(a, b)

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(taro, hanako)

Solution (Python):
acount = 0
bcount = 0



n = int(input())
 
for i in range(n) :
  A = []
  a,b = map(str,input().split())
  A.append(a)
  A.append(b)
  A .sort()
  
    
  if A[1] == a and A[0] != a   :
    acount += 3
   
  elif A[1] == b and A[0] != b:
    bcount += 3
  elif A[0] == A[1]:
    acount += 1 
    bcount += 1
    

print(acount , bcount)

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

s_t = 0
s_h = 0
for i in range(n):
    c_t, c_h = input().split()
    if c_t > c_h:
        s_t += 3
    elif c_t < c_h:
        s_h += 3
    else:
        s_t += 1
        s_h += 1

print(s_t, s_h)

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

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

Solution (Python):
import random

n = int(input(""))
Taro = 0
Hanako = 0
get_point_w = 3
get_point_d = 1

def judge(card_a, card_b, get_point_w, get_point_d, point_a, point_b):
    win_card = max(card_a, card_b)
    if card_a == card_b:
        point_a += get_point_d
        point_b += get_point_d
    elif win_card == card_a:
        point_a += get_point_w
    elif win_card == card_b:
        point_b += get_point_w
    else:
        print("bad input!")  
    
    return point_a, point_b
    
if n <= 1000:
    for i in range(n):
        card_Taro_Hanako = input()
        card_Taro = card_Taro_Hanako.split(" ")[0]
        card_Hanako = card_Taro_Hanako.split(" ")[1]
        if len(card_Taro) <= 100 and len(card_Hanako) <= 100:
            Taro, Hanako = judge(card_Taro, card_Hanako, get_point_w, get_point_d, Taro, Hanako)
        else:
            print("animal name string length > 100, bad input!")
else:
    print("n > 1000, bad input!")
print(Taro, Hanako)

Solution (Python):
a=int(input())
ts=0
hs=0
while a>0:
   tarou , hanako = input().split(" ")
   if tarou < hanako:
     hs+=3
   elif tarou > hanako:
     ts+=3
   else:
     hs+=1													
     ts+=1
   a=a-1
print(str(ts)+' '+str(hs))

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())
p = q = 0
for i in range(n):
  a, b = input().split()
  if a < b:
    q += 3
  elif a > b:
    p += 3
  else:
    p += 1
    q += 1
print(p, q)

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

print(t,h)

Solution (Python):
a = b = 0
for i in range(int(input())):
    ac, bc = input().split()

    if bc < ac:
        a += 3
    elif bc == ac:
        a += 1
        b += 1
    else:
        b += 3
print(a, b)

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

Solution (Python):
from functools import reduce

point_judge = {
    'card_taro > card_hanako': (3,0),
    'card_taro == card_hanako': (1,1),
    'card_taro < card_hanako': (0,3)
}

def solve():
    input_line = input()
    n = int(input_line)
    input_lines = [input() for _ in range(n)]

    print("{0} {1}".format(
        *reduce(lambda x,y: (x[0]+y[0],x[1]+y[1]) , 
                [ v for card_taro, card_hanako in 
                 [ input_line.split(' ') for input_line in input_lines ]
                 for k,v in point_judge.items() if eval(k) ]
               )))

solve()

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())
ans = [0,0]
for i in range(n):
    a,b = map(str,input().split())
    if a > b:
        ans[0] += 3
    elif a == b:
        ans[0] += 1
        ans[1] += 1
    elif b > a:
        ans[1] += 3
print(" ".join(map(str,ans)))

Solution (Python):
n=int(input())
t_won=0
h_won=0
for _ 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):
n=int(input())
t_won=0
h_won=0
for _ 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):
n=input()
t=h=0
for i in range(n):
    x,y=map(str,raw_input().split())
    if x==y:
        t+=1
        h+=1
    elif x<y:
        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):
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())
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())

point_tarou = 0
point_hanako = 0

for turn in range(n):

    tarou, hanako = input().split()

    if   tarou >  hanako:
        point_tarou += 3
    elif tarou <  hanako:
        point_hanako += 3
    else:
        point_tarou += 1
        point_hanako += 1

print(f"{point_tarou} {point_hanako}")

Solution (Python):
taro = 0
hanako = 0
n = int(input())
for _ in range(n):
    moji1, moji2 = input().split()
    if moji1 == moji2:
        taro += 1
        hanako += 1
    else:
        for m1, m2 in zip(moji1, moji2):
            p1, p2 = map(ord, (m1, m2))
            if p1 != p2:
                break
        else:
            p1 = len(moji1)
            p2 = len(moji2)
        if p1 > p2:
            taro += 3
        else:
            hanako += 3
print(f'{taro} {hanako}')

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

if __name__ == "__main__":
    n = int(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)

Solution (Python):

taro = 0
hanako = 0
for i in range(int(input())):
    x, y = input().split()
    if x > y:
        taro+=3
    elif x < y:
        hanako+=3
    else:
        taro+=1
        hanako+=1
print(str(taro) + ' ' + str(hanako))

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

game_num = int(input())

point_Taro = 0
point_Hanako = 0

for i in range(game_num):
        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())
alice = 0
bob = 0
for _ in range(N):
    a, b = input().split()
    if a == b:
        alice += 1
        bob += 1
    elif a > b:
        alice += 3
    else:
        bob += 3
print(alice, bob)

Solution (Python):
if __name__ == '__main__':
	turn = int(input())
	taro, hanako = 0,0
	for i in range(turn):
		t_card, h_card = map(str,input().split())
		if t_card > h_card:
			taro += 3
		elif h_card > t_card:
			hanako += 3
		else:
			taro +=1
			hanako += 1
	print("%d %d" % (taro,hanako))

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

Solution (Python):



def btlcmp(taro, hanako):
    if taro > hanako :
        return 0
    elif taro == hanako :
        return 1

    return 2

res = [[3,0],[1,1],[0,3]]

taro_p = 0
hanako_p = 0

btltime = int(input())

for i in range(btltime):
    s = input().split()
    resi = btlcmp(s[0], s[1])
    taro_p += res[resi][0]
    hanako_p += res[resi][1]

print(str(taro_p) +" "+ str(hanako_p))

Solution (Python):
num = int(input())
T = 0
H = 0
for i in range(num):
    line = list(map(str, input().split()))
    sorted_line = sorted(line)
    if line[0] == line[1]:
        T += 1
        H += 1
    elif line[0] == sorted_line[0]:
        H += 3
    elif line[0] == sorted_line[1]:
        T += 3
print(T,H)

Solution (Python):
num = int(input())
point= [0,0]
while(num > 0):
    x = input()
    t,h = x.split(" ")
    if(t > h):
        point[0] += 3
    elif(t == h):
        point[0] += 1
        point[1] += 1
    else:
        point[1] +=3
    
    num -= 1
print("{} {}".format(point[0],point[1]))

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(taro, hanako)

Solution (Python):
num = int(input())
taro = 0
hanako = 0
for _ in range(num):
    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())
w=d=0
for _ in[0]*n:
	t,h=input().split()
	if t>h:w+=1
	if t==h:d+=1
print(w*3+d,(n-w-d)*3+d)

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

for k in range(0, i):
    a = input()
    a = a.split()
    [x, y] = a

    if x > y:
        taro = taro + 3
    elif y > x:
        hanako = hanako + 3
    elif x == y:
        taro = taro + 1
        hanako = hanako + 1

taro = str(taro)
hanako = str(hanako)
k = " "

ans = taro + k + hanako
print(ans)