import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        String a_card = null;
        String b_card = null;
        int a_point = 0;
        int b_point = 0;

        int j = 0;
        int i = 0;

        int compare_length = 0;


        while(i < m){

            a_card = scan.next().toLowerCase();
            b_card = scan.next().toLowerCase();
            if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            }

            j = 0;
            while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            }

            i++;
        }

        System.out.println(a_point + " " + b_point);

    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        String a_card = null;
        String b_card = null;
        int a_point = 0;
        int b_point = 0;

        int j = 0;
        int i = 0;

        int compare_length = 0;


        while(i < m){

            a_card = scan.next().toLowerCase();
            b_card = scan.next().toLowerCase();
            if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            }

            j = 0;
            while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            }

            i++;
        }

        System.out.println(a_point + " " + b_point);

    }
} Main public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        String a_card = null;
        String b_card = null;
        int a_point = 0;
        int b_point = 0;

        int j = 0;
        int i = 0;

        int compare_length = 0;


        while(i < m){

            a_card = scan.next().toLowerCase();
            b_card = scan.next().toLowerCase();
            if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            }

            j = 0;
            while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            }

            i++;
        }

        System.out.println(a_point + " " + b_point);

    } main {
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        String a_card = null;
        String b_card = null;
        int a_point = 0;
        int b_point = 0;

        int j = 0;
        int i = 0;

        int compare_length = 0;


        while(i < m){

            a_card = scan.next().toLowerCase();
            b_card = scan.next().toLowerCase();
            if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            }

            j = 0;
            while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            }

            i++;
        }

        System.out.println(a_point + " " + b_point);

    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan String a_card = null; a_card null String b_card = null; b_card null int a_point = 0; a_point 0 int b_point = 0; b_point 0 int j = 0; j 0 int i = 0; i 0 int compare_length = 0; compare_length 0 while(i < m){

            a_card = scan.next().toLowerCase();
            b_card = scan.next().toLowerCase();
            if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            }

            j = 0;
            while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            }

            i++;
        } i < m i m {

            a_card = scan.next().toLowerCase();
            b_card = scan.next().toLowerCase();
            if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            }

            j = 0;
            while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            }

            i++;
        } a_card = scan.next().toLowerCase() a_card scan.next().toLowerCase() scan.next().toLowerCase scan.next() scan.next scan b_card = scan.next().toLowerCase() b_card scan.next().toLowerCase() scan.next().toLowerCase scan.next() scan.next scan if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            } a_card.length() < b_card.length() a_card.length() a_card.length a_card b_card.length() b_card.length b_card {
                compare_length = a_card.length();
            } compare_length = a_card.length() compare_length a_card.length() a_card.length a_card {
                compare_length = b_card.length();
            } compare_length = b_card.length() compare_length b_card.length() b_card.length b_card j = 0 j 0 while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            } true {
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            } if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                } a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1) a_card.charAt(j) == b_card.charAt(j) a_card.charAt(j) a_card.charAt a_card j b_card.charAt(j) b_card.charAt b_card j compare_length == (j + 1) compare_length (j + 1) j 1 {
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                } if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    } compare_length < a_card.length() compare_length a_card.length() a_card.length a_card {
                        a_point += 3;
                        break;
                    } a_point += 3 a_point 3 break; if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    } compare_length < b_card.length() compare_length b_card.length() b_card.length b_card {
                        b_point += 3;
                        break;
                    } b_point += 3 b_point 3 break; a_point++ a_point b_point++ b_point break; if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                } a_card.charAt(j) == b_card.charAt(j) a_card.charAt(j) a_card.charAt a_card j b_card.charAt(j) b_card.charAt b_card j {

                    
                    j++;
                } j++ j if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                } a_card.charAt(j) < b_card.charAt(j) a_card.charAt(j) a_card.charAt a_card j b_card.charAt(j) b_card.charAt b_card j {
                    b_point += 3;
     
                    break;
                } b_point += 3 b_point 3 break; if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                } a_card.charAt(j) > b_card.charAt(j) a_card.charAt(j) a_card.charAt a_card j b_card.charAt(j) b_card.charAt b_card j {
                    a_point += 3;
                
                    break;

                } a_point += 3 a_point 3 break; i++ i System.out.println(a_point + " " + b_point) System.out.println System.out System System.out a_point + " " + b_point a_point + " " + b_point a_point " " b_point String[] args args public class Main {
    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        String a_card = null;
        String b_card = null;
        int a_point = 0;
        int b_point = 0;

        int j = 0;
        int i = 0;

        int compare_length = 0;


        while(i < m){

            a_card = scan.next().toLowerCase();
            b_card = scan.next().toLowerCase();
            if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            }

            j = 0;
            while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            }

            i++;
        }

        System.out.println(a_point + " " + b_point);

    }
} public class Main {
    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        String a_card = null;
        String b_card = null;
        int a_point = 0;
        int b_point = 0;

        int j = 0;
        int i = 0;

        int compare_length = 0;


        while(i < m){

            a_card = scan.next().toLowerCase();
            b_card = scan.next().toLowerCase();
            if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            }

            j = 0;
            while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            }

            i++;
        }

        System.out.println(a_point + " " + b_point);

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        String a_card = null;
        String b_card = null;
        int a_point = 0;
        int b_point = 0;

        int j = 0;
        int i = 0;

        int compare_length = 0;


        while(i < m){

            a_card = scan.next().toLowerCase();
            b_card = scan.next().toLowerCase();
            if(a_card.length() < b_card.length()){
                compare_length = a_card.length();
            }else{
                compare_length = b_card.length();
            }

            j = 0;
            while(true){
                if(a_card.charAt(j) == b_card.charAt(j) && compare_length == (j + 1)){
                    if(compare_length < a_card.length()){
                        a_point += 3;
                        break;
                    }else if(compare_length < b_card.length()){
                        b_point += 3;
                        break;
                    }
                    a_point++;
                    b_point++;
                   
                    break;
                }else if(a_card.charAt(j) == b_card.charAt(j)){

                    
                    j++;
                }else if(a_card.charAt(j) < b_card.charAt(j)){
                    b_point += 3;
     
                    break;
                }else if(a_card.charAt(j) > b_card.charAt(j)){
                    a_point += 3;
                
                    break;

                }

            }

            i++;
        }

        System.out.println(a_point + " " + b_point);

    }
}

