import java.util.Scanner;

class Main {
  public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
	int deck = scanner.nextInt();	//ターン数,山札数
	int count = 0;
	int sum_t = 0;
	int sum_h = 0;
  	int Judge = 0;
  	int card_stlength_t;
  	int card_stlength_h;
  	int card_stlength;
  	int case_st = 0;
  	String work_t,work_h;
  	String alf[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
  			"q","r","s","t","u","v","w","x","y","z"};
  	boolean bJudge = true;
  	
  	
  	do {
		String card_t = scanner.next();	//太郎の文字
		String card_h = scanner.next();	//花子の文字
  		
  		//引き分け
  		if( card_t.equals(card_h) ){
  			Judge = 0;
  		}
  		//カードの文字数取得
  		card_stlength_t = card_t.length();
  		card_stlength_h = card_h.length();
  		
  		if( card_stlength_t == card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 0;
  		}else if( card_stlength_t > card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		}else{
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		}
  		
  		//カードの比較
  		for( int i = 0; i < card_stlength ; i ++ ) {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		}
  		
  		
  		//点の加点
  		switch ( Judge ){
  		case 0:
  			sum_t ++;
  			sum_h ++;
  			break;
  		case 1:
  			sum_t += 3;
  			break;
  		case 2:
  			sum_h += 3;
  			break;
  		}
  		
  		//終了判定
  		count ++;
  		if( count >= deck ) {
  			bJudge = false;
  		}
  		
  	}while( bJudge );
  	
  	  	//結果出力
  		System.out.println(sum_t + " " + sum_h);
	
  	//後処理
	scanner.close();
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
	int deck = scanner.nextInt();	//ターン数,山札数
	int count = 0;
	int sum_t = 0;
	int sum_h = 0;
  	int Judge = 0;
  	int card_stlength_t;
  	int card_stlength_h;
  	int card_stlength;
  	int case_st = 0;
  	String work_t,work_h;
  	String alf[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
  			"q","r","s","t","u","v","w","x","y","z"};
  	boolean bJudge = true;
  	
  	
  	do {
		String card_t = scanner.next();	//太郎の文字
		String card_h = scanner.next();	//花子の文字
  		
  		//引き分け
  		if( card_t.equals(card_h) ){
  			Judge = 0;
  		}
  		//カードの文字数取得
  		card_stlength_t = card_t.length();
  		card_stlength_h = card_h.length();
  		
  		if( card_stlength_t == card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 0;
  		}else if( card_stlength_t > card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		}else{
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		}
  		
  		//カードの比較
  		for( int i = 0; i < card_stlength ; i ++ ) {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		}
  		
  		
  		//点の加点
  		switch ( Judge ){
  		case 0:
  			sum_t ++;
  			sum_h ++;
  			break;
  		case 1:
  			sum_t += 3;
  			break;
  		case 2:
  			sum_h += 3;
  			break;
  		}
  		
  		//終了判定
  		count ++;
  		if( count >= deck ) {
  			bJudge = false;
  		}
  		
  	}while( bJudge );
  	
  	  	//結果出力
  		System.out.println(sum_t + " " + sum_h);
	
  	//後処理
	scanner.close();
  }
} Main public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
	int deck = scanner.nextInt();	//ターン数,山札数
	int count = 0;
	int sum_t = 0;
	int sum_h = 0;
  	int Judge = 0;
  	int card_stlength_t;
  	int card_stlength_h;
  	int card_stlength;
  	int case_st = 0;
  	String work_t,work_h;
  	String alf[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
  			"q","r","s","t","u","v","w","x","y","z"};
  	boolean bJudge = true;
  	
  	
  	do {
		String card_t = scanner.next();	//太郎の文字
		String card_h = scanner.next();	//花子の文字
  		
  		//引き分け
  		if( card_t.equals(card_h) ){
  			Judge = 0;
  		}
  		//カードの文字数取得
  		card_stlength_t = card_t.length();
  		card_stlength_h = card_h.length();
  		
  		if( card_stlength_t == card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 0;
  		}else if( card_stlength_t > card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		}else{
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		}
  		
  		//カードの比較
  		for( int i = 0; i < card_stlength ; i ++ ) {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		}
  		
  		
  		//点の加点
  		switch ( Judge ){
  		case 0:
  			sum_t ++;
  			sum_h ++;
  			break;
  		case 1:
  			sum_t += 3;
  			break;
  		case 2:
  			sum_h += 3;
  			break;
  		}
  		
  		//終了判定
  		count ++;
  		if( count >= deck ) {
  			bJudge = false;
  		}
  		
  	}while( bJudge );
  	
  	  	//結果出力
  		System.out.println(sum_t + " " + sum_h);
	
  	//後処理
	scanner.close();
  } main {
	Scanner scanner = new Scanner(System.in);
	int deck = scanner.nextInt();	//ターン数,山札数
	int count = 0;
	int sum_t = 0;
	int sum_h = 0;
  	int Judge = 0;
  	int card_stlength_t;
  	int card_stlength_h;
  	int card_stlength;
  	int case_st = 0;
  	String work_t,work_h;
  	String alf[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
  			"q","r","s","t","u","v","w","x","y","z"};
  	boolean bJudge = true;
  	
  	
  	do {
		String card_t = scanner.next();	//太郎の文字
		String card_h = scanner.next();	//花子の文字
  		
  		//引き分け
  		if( card_t.equals(card_h) ){
  			Judge = 0;
  		}
  		//カードの文字数取得
  		card_stlength_t = card_t.length();
  		card_stlength_h = card_h.length();
  		
  		if( card_stlength_t == card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 0;
  		}else if( card_stlength_t > card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		}else{
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		}
  		
  		//カードの比較
  		for( int i = 0; i < card_stlength ; i ++ ) {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		}
  		
  		
  		//点の加点
  		switch ( Judge ){
  		case 0:
  			sum_t ++;
  			sum_h ++;
  			break;
  		case 1:
  			sum_t += 3;
  			break;
  		case 2:
  			sum_h += 3;
  			break;
  		}
  		
  		//終了判定
  		count ++;
  		if( count >= deck ) {
  			bJudge = false;
  		}
  		
  	}while( bJudge );
  	
  	  	//結果出力
  		System.out.println(sum_t + " " + sum_h);
	
  	//後処理
	scanner.close();
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int deck = scanner.nextInt(); deck scanner.nextInt() scanner.nextInt scanner int count = 0; count 0 int sum_t = 0; sum_t 0 int sum_h = 0; sum_h 0 int Judge = 0; Judge 0 int card_stlength_t; card_stlength_t int card_stlength_h; card_stlength_h int card_stlength; card_stlength int case_st = 0; case_st 0 String work_t work_t work_h; work_h String alf[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
  			"q","r","s","t","u","v","w","x","y","z"}; alf {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
  			"q","r","s","t","u","v","w","x","y","z"} "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" boolean bJudge = true; bJudge true do {
		String card_t = scanner.next();	//太郎の文字
		String card_h = scanner.next();	//花子の文字
  		
  		//引き分け
  		if( card_t.equals(card_h) ){
  			Judge = 0;
  		}
  		//カードの文字数取得
  		card_stlength_t = card_t.length();
  		card_stlength_h = card_h.length();
  		
  		if( card_stlength_t == card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 0;
  		}else if( card_stlength_t > card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		}else{
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		}
  		
  		//カードの比較
  		for( int i = 0; i < card_stlength ; i ++ ) {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		}
  		
  		
  		//点の加点
  		switch ( Judge ){
  		case 0:
  			sum_t ++;
  			sum_h ++;
  			break;
  		case 1:
  			sum_t += 3;
  			break;
  		case 2:
  			sum_h += 3;
  			break;
  		}
  		
  		//終了判定
  		count ++;
  		if( count >= deck ) {
  			bJudge = false;
  		}
  		
  	}while( bJudge ); bJudge {
		String card_t = scanner.next();	//太郎の文字
		String card_h = scanner.next();	//花子の文字
  		
  		//引き分け
  		if( card_t.equals(card_h) ){
  			Judge = 0;
  		}
  		//カードの文字数取得
  		card_stlength_t = card_t.length();
  		card_stlength_h = card_h.length();
  		
  		if( card_stlength_t == card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 0;
  		}else if( card_stlength_t > card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		}else{
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		}
  		
  		//カードの比較
  		for( int i = 0; i < card_stlength ; i ++ ) {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		}
  		
  		
  		//点の加点
  		switch ( Judge ){
  		case 0:
  			sum_t ++;
  			sum_h ++;
  			break;
  		case 1:
  			sum_t += 3;
  			break;
  		case 2:
  			sum_h += 3;
  			break;
  		}
  		
  		//終了判定
  		count ++;
  		if( count >= deck ) {
  			bJudge = false;
  		}
  		
  	} String card_t = scanner.next(); card_t scanner.next() scanner.next scanner String card_h = scanner.next(); card_h scanner.next() scanner.next scanner if( card_t.equals(card_h) ){
  			Judge = 0;
  		} card_t.equals(card_h) card_t.equals card_t card_h {
  			Judge = 0;
  		} Judge = 0 Judge 0 card_stlength_t = card_t.length() card_stlength_t card_t.length() card_t.length card_t card_stlength_h = card_h.length() card_stlength_h card_h.length() card_h.length card_h if( card_stlength_t == card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 0;
  		}else if( card_stlength_t > card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		}else{
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		} card_stlength_t == card_stlength_h card_stlength_t card_stlength_h {
  			card_stlength = card_stlength_t;
  			case_st = 0;
  		} card_stlength = card_stlength_t card_stlength card_stlength_t case_st = 0 case_st 0 if( card_stlength_t > card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		}else{
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		} card_stlength_t > card_stlength_h card_stlength_t card_stlength_h {
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		} card_stlength = card_stlength_t card_stlength card_stlength_t case_st = 1 case_st 1 {
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		} card_stlength = card_stlength_h card_stlength card_stlength_h case_st = 2 case_st 2 for( int i = 0; i < card_stlength ; i ++ ) {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		} int i = 0; int i = 0; i 0 i < card_stlength i card_stlength i ++ i ++ i {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		} {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		} if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			} case_st == 1 && i == card_stlength_h case_st == 1 case_st 1 i == card_stlength_h i card_stlength_h {
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			} Judge = 1 Judge 1 break; if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			} case_st == 2 && i == card_stlength_t case_st == 2 case_st 2 i == card_stlength_t i card_stlength_t {
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			} Judge = 2 Judge 2 break; {
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			} work_t = card_t.substring(i, i +1) work_t card_t.substring(i, i +1) card_t.substring card_t i i +1 i 1 int j = 0; j 0 int k = 0; k 0 int ncard_t = 0 ncard_t 0 ncard_h = 0; ncard_h 0 while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				} true {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				} ncard_t ++ ncard_t if(work_t.equals( alf[j] ))
						break; work_t.equals( alf[j] ) work_t.equals work_t alf[j] alf j break; j ++ j work_h = card_h.substring(i, i+ 1) work_h card_h.substring(i, i+ 1) card_h.substring card_h i i+ 1 i 1 while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				} true {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				} ncard_h ++ ncard_h if(work_h.equals( alf[k] ))
						break; work_h.equals( alf[k] ) work_h.equals work_h alf[k] alf k break; k ++ k if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			} ncard_t > ncard_h ncard_t ncard_h {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			} Judge = 1 Judge 1 break; if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			} ncard_t < ncard_h ncard_t ncard_h {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			} Judge = 2 Judge 2 break; switch ( Judge ){
  		case 0:
  			sum_t ++;
  			sum_h ++;
  			break;
  		case 1:
  			sum_t += 3;
  			break;
  		case 2:
  			sum_h += 3;
  			break;
  		} Judge case 0: 0 case 0: sum_t ++ sum_t sum_h ++ sum_h break; case 1: 1 case 1: sum_t += 3 sum_t 3 break; case 2: 2 case 2: sum_h += 3 sum_h 3 break; count ++ count if( count >= deck ) {
  			bJudge = false;
  		} count >= deck count deck {
  			bJudge = false;
  		} bJudge = false bJudge false System.out.println(sum_t + " " + sum_h) System.out.println System.out System System.out sum_t + " " + sum_h sum_t + " " + sum_h sum_t " " sum_h scanner.close() scanner.close scanner String args[] args
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
	int deck = scanner.nextInt();	//ターン数,山札数
	int count = 0;
	int sum_t = 0;
	int sum_h = 0;
  	int Judge = 0;
  	int card_stlength_t;
  	int card_stlength_h;
  	int card_stlength;
  	int case_st = 0;
  	String work_t,work_h;
  	String alf[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
  			"q","r","s","t","u","v","w","x","y","z"};
  	boolean bJudge = true;
  	
  	
  	do {
		String card_t = scanner.next();	//太郎の文字
		String card_h = scanner.next();	//花子の文字
  		
  		//引き分け
  		if( card_t.equals(card_h) ){
  			Judge = 0;
  		}
  		//カードの文字数取得
  		card_stlength_t = card_t.length();
  		card_stlength_h = card_h.length();
  		
  		if( card_stlength_t == card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 0;
  		}else if( card_stlength_t > card_stlength_h ){
  			card_stlength = card_stlength_t;
  			case_st = 1;
  		}else{
  			card_stlength = card_stlength_h;
  			case_st = 2;
  		}
  		
  		//カードの比較
  		for( int i = 0; i < card_stlength ; i ++ ) {
		  		//System.out.println("比較判定");
  			if( case_st == 1 && i == card_stlength_h ){
  				Judge = 1;
  		  		//System.out.println("太郎勝ち");
  				break;
  			}else if( case_st == 2 && i == card_stlength_t ){
  				Judge = 2;
  		  		//System.out.println("花子勝ち");
  				break;
  			}else{
	  			work_t = card_t.substring(i, i +1);
	  			int j = 0;
  				int k = 0;
	  			int ncard_t = 0,ncard_h = 0;
  				//太郎の強さ
				while( true  ) {
					ncard_t ++;
					if(work_t.equals( alf[j] ))
						break;
					j ++;
				}
  				work_h = card_h.substring(i, i+ 1);
				//花子の強さ
				while( true  ) {
					ncard_h ++;
					if(work_h.equals( alf[k] ))
						break;
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  		  		//System.out.println("太郎勝ち");
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  		  		//System.out.println("花子勝ち");
	  				Judge = 2;
	  				break;
	  			}
  			}
  			
  		}
  		
  		
  		//点の加点
  		switch ( Judge ){
  		case 0:
  			sum_t ++;
  			sum_h ++;
  			break;
  		case 1:
  			sum_t += 3;
  			break;
  		case 2:
  			sum_h += 3;
  			break;
  		}
  		
  		//終了判定
  		count ++;
  		if( count >= deck ) {
  			bJudge = false;
  		}
  		
  	}while( bJudge );
  	
  	  	//結果出力
  		System.out.println(sum_t + " " + sum_h);
	
  	//後処理
	scanner.close();
  }
}
