import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words1, words2;
        int wordl,result,score1=0,score2=0;
        int n=scan.nextInt();
        
        for(int i=0; i<n; i++){
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        }
        System.out.println(score1+" "+score2);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words1, words2;
        int wordl,result,score1=0,score2=0;
        int n=scan.nextInt();
        
        for(int i=0; i<n; i++){
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        }
        System.out.println(score1+" "+score2);
    }
} Main public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words1, words2;
        int wordl,result,score1=0,score2=0;
        int n=scan.nextInt();
        
        for(int i=0; i<n; i++){
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        }
        System.out.println(score1+" "+score2);
    } main {
        Scanner scan=new Scanner(System.in);
        String words1, words2;
        int wordl,result,score1=0,score2=0;
        int n=scan.nextInt();
        
        for(int i=0; i<n; i++){
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        }
        System.out.println(score1+" "+score2);
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String words1 words1 words2; words2 int wordl wordl result result score1=0 score1 0 score2=0; score2 0 int n=scan.nextInt(); n scan.nextInt() scan.nextInt scan for(int i=0; i<n; i++){
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        } {
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        } result=0 result 0 words1=scan.next() words1 scan.next() scan.next scan words2=scan.next() words2 scan.next() scan.next scan wordl=Math.min(words1.length(), words2.length()) wordl Math.min(words1.length(), words2.length()) Math.min Math words1.length() words1.length words1 words2.length() words2.length words2 for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            } int j=0; int j=0; j 0 j<wordl j wordl j++ j++ j {
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            } {
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            } if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                } words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0 words1.substring(j,j+1).compareTo(words2.substring(j,j+1)) words1.substring(j,j+1).compareTo words1.substring(j,j+1) words1.substring words1 j j+1 j 1 words2.substring(j,j+1) words2.substring words2 j j+1 j 1 0 {
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                } result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1)) result words1.substring(j,j+1).compareTo(words2.substring(j,j+1)) words1.substring(j,j+1).compareTo words1.substring(j,j+1) words1.substring words1 j j+1 j 1 words2.substring(j,j+1) words2.substring words2 j j+1 j 1 break; if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3; result>0 result 0 score1+=3 score1 3 if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3; result==0 result 0 {
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            } if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                } words1.length()>words2.length() words1.length() words1.length words1 words2.length() words2.length words2 score1+=3 score1 3 if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                } words1.length()<words2.length() words1.length() words1.length words1 words2.length() words2.length words2 score2+=3 score2 3 {
                    score1++;
                    score2++;
                } score1++ score1 score2++ score2 score2+=3 score2 3 System.out.println(score1+" "+score2) System.out.println System.out System System.out score1+" "+score2 score1+" "+score2 score1 " " score2 String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words1, words2;
        int wordl,result,score1=0,score2=0;
        int n=scan.nextInt();
        
        for(int i=0; i<n; i++){
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        }
        System.out.println(score1+" "+score2);
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words1, words2;
        int wordl,result,score1=0,score2=0;
        int n=scan.nextInt();
        
        for(int i=0; i<n; i++){
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        }
        System.out.println(score1+" "+score2);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words1, words2;
        int wordl,result,score1=0,score2=0;
        int n=scan.nextInt();
        
        for(int i=0; i<n; i++){
            result=0;
            words1=scan.next();
            words2=scan.next();
            
            wordl=Math.min(words1.length(), words2.length());
            for(int j=0; j<wordl; j++){
                if(words1.substring(j,j+1).compareTo(words2.substring(j,j+1))!=0){
                    result=words1.substring(j,j+1).compareTo(words2.substring(j,j+1));
                    break;
                }
            }
            if(result>0)score1+=3;
            else if(result==0){
                if(words1.length()>words2.length())score1+=3;
                else if(words1.length()<words2.length())score2+=3;
                else{
                    score1++;
                    score2++;
                }
            }else score2+=3;
        }
        System.out.println(score1+" "+score2);
    }
}
