import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int n = Integer.parseInt(scanner.nextLine());
        int tScore = 0;
        int hScore = 0;

        for(int i = 0; i < n; i++){
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        }

        System.out.printf("%d %d\n", tScore, hScore);

        scanner.close();
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int n = Integer.parseInt(scanner.nextLine());
        int tScore = 0;
        int hScore = 0;

        for(int i = 0; i < n; i++){
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        }

        System.out.printf("%d %d\n", tScore, hScore);

        scanner.close();
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int n = Integer.parseInt(scanner.nextLine());
        int tScore = 0;
        int hScore = 0;

        for(int i = 0; i < n; i++){
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        }

        System.out.printf("%d %d\n", tScore, hScore);

        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);

        int n = Integer.parseInt(scanner.nextLine());
        int tScore = 0;
        int hScore = 0;

        for(int i = 0; i < n; i++){
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        }

        System.out.printf("%d %d\n", tScore, hScore);

        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = Integer.parseInt(scanner.nextLine()); n Integer.parseInt(scanner.nextLine()) Integer.parseInt Integer scanner.nextLine() scanner.nextLine scanner int tScore = 0; tScore 0 int hScore = 0; hScore 0 for(int i = 0; i < n; i++){
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        } {
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        } String taro = scanner.next().toLowerCase(); taro scanner.next().toLowerCase() scanner.next().toLowerCase scanner.next() scanner.next scanner String hana = scanner.next().toLowerCase(); hana scanner.next().toLowerCase() scanner.next().toLowerCase scanner.next() scanner.next scanner if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            } taro.equals(hana) taro.equals taro hana {
                tScore++;
                hScore++;
            } tScore++ tScore hScore++ hScore {
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            } char[] tCh = taro.toCharArray(); tCh taro.toCharArray() taro.toCharArray taro char[] hCh = hana.toCharArray(); hCh hana.toCharArray() hana.toCharArray hana int min = tCh.length < hCh.length ? tCh.length : hCh.length; min tCh.length < hCh.length ? tCh.length : hCh.length tCh.length < hCh.length tCh.length tCh tCh.length hCh.length hCh hCh.length tCh.length tCh tCh.length hCh.length hCh hCh.length int index = 0; index 0 do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min); index <= min index min {
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                } if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    } index == min index min {
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   } if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       } tCh.length > hCh.length tCh.length tCh tCh.length hCh.length hCh hCh.length {
                           tScore += 3;
                       } tScore += 3 tScore 3 {
                           hScore += 3;
                       } hScore += 3 hScore 3 break; if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    } tCh[index] == hCh[index] tCh[index] tCh index hCh[index] hCh index {
                        index++;
                    } index++ index if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    } tCh[index] > hCh[index] tCh[index] tCh index hCh[index] hCh index {
                        tScore += 3;
                        break;
                    } tScore += 3 tScore 3 break; if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    } tCh[index] < hCh[index] tCh[index] tCh index hCh[index] hCh index {
                        hScore += 3;
                        break;
                    } hScore += 3 hScore 3 break; System.out.printf("%d %d\n", tScore, hScore) System.out.printf System.out System System.out "%d %d\n" tScore hScore scanner.close() scanner.close scanner String[] args args public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int n = Integer.parseInt(scanner.nextLine());
        int tScore = 0;
        int hScore = 0;

        for(int i = 0; i < n; i++){
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        }

        System.out.printf("%d %d\n", tScore, hScore);

        scanner.close();
    }
} public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int n = Integer.parseInt(scanner.nextLine());
        int tScore = 0;
        int hScore = 0;

        for(int i = 0; i < n; i++){
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        }

        System.out.printf("%d %d\n", tScore, hScore);

        scanner.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int n = Integer.parseInt(scanner.nextLine());
        int tScore = 0;
        int hScore = 0;

        for(int i = 0; i < n; i++){
            String taro = scanner.next().toLowerCase();
            String hana = scanner.next().toLowerCase();

            if(taro.equals(hana)){
                tScore++;
                hScore++;
            }else{
                char[] tCh = taro.toCharArray();
                char[] hCh = hana.toCharArray();

                int min = tCh.length < hCh.length ? tCh.length : hCh.length;
                int index = 0;
               do{
                   if(index == min){
                       if(tCh.length > hCh.length){
                           tScore += 3;
                       }else {
                           hScore += 3;
                       }
                       break;
                   }else if(tCh[index] == hCh[index]){
                        index++;
                    }else if(tCh[index] > hCh[index]){
                        tScore += 3;
                        break;
                    } else if (tCh[index] < hCh[index]) {
                        hScore += 3;
                        break;
                    }


                }while(index <= min);
            }

        }

        System.out.printf("%d %d\n", tScore, hScore);

        scanner.close();
    }
}

