import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;



public class Main{
	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int num;
		int point_Taro=0;
		int point_Hanako=0;
		int Taro, Hanako;
		char[] charstr_Taro;
		char[] charstr_Hanako;
		String str;
		String[] str_array;
		int len_Taro, len_Hanako;


		try{

			num=Integer.parseInt(reader.readLine());

			for(int i=0;i<num;i++){
				str=reader.readLine();
				str_array=str.split(" ");
				charstr_Taro=str_array[0].toCharArray();
				charstr_Hanako=str_array[1].toCharArray();

				len_Taro=charstr_Taro.length;
				len_Hanako=charstr_Hanako.length;


				for(int j=0;j<len_Taro&&j<len_Hanako;j++){//???????????????????????????????????????
					Taro=charstr_Taro[j];
					Hanako=charstr_Hanako[j];

					if(Taro>Hanako){

						point_Taro+=3;
					    break;
					}else if(Taro<Hanako){

						point_Hanako+=3;
					    break;
					}

					if(j==len_Taro-1 && len_Taro<len_Hanako){
						point_Hanako+=3;
						break;
					}else if(j==len_Hanako-1 && len_Taro>len_Hanako){
						point_Taro+=3;
						break;
					}else if(j==len_Taro-1&&len_Taro==len_Hanako){
					point_Hanako++;
					point_Taro++;
					break;}
				}



			}//num?????°????????????
			System.out.println(point_Taro+" "+point_Hanako);

		}catch(IOException e){
			System.out.print(e);
		}
	}

}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz