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 in JAVA (judge verdict: Runtime Error)

import java.util.Scanner;

class Main {
  public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
	long deck = scanner.nextInt();	//ターン数,山札数
	long count = 0;
	long sum_t = 0;
	long sum_h = 0;
  	int Judge = 0;
  	long card_stlength_t = 0;
  	long card_stlength_h = 0;
  	long card_stlength = 0;
  	long 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;
  	int ncard_t = 0,ncard_h = 0;	//初期化
  	
  	
  	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 ++ ) {
  			if( case_st == 1 && i >= card_stlength_h ){
  				Judge = 1;
  			}else if( case_st == 2 && i >= card_stlength_t ){
  				Judge = 2;
  			}else if( case_st == 0 ) {
  		  		//System.out.println("違うね");
	  			work_t = card_t.substring(i, 1);
	  			int j = 0;
  				int k = 0;
  				ncard_t = 0;
  				ncard_h = 0;
  				//太郎の強さ
				while( true ) {
	  		  		//System.out.println("太郎の計算");
					ncard_t ++;
					if(work_t.equals( alf[j] )) {
						break;
					}
					j ++;
				}
  				work_h = card_h.substring(i, 1);
				//花子の強さ
				while( true  ) {
	  		  		//System.out.println("花子の計算");
					ncard_h ++;
					if(work_h.equals( alf[k] )) {
						break;
					}
					k ++;
				}
	  			
	  			if( ncard_t > ncard_h ) {
	  				Judge = 1;
	  				break;
	  			}else if( ncard_t < ncard_h ) {
	  				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();
  }
}