using System;
class Program
{
    static void Main()
    {
        Manipulation manip = new Manipulation();
        const int CARDS = 1000;
        const int ARRAYER = 1;
        const int INIT = 0;
        string[] alpha;
        int delta = int.Parse(Console.ReadLine());

        char[] taroHArr;
        char[] hanaArr;
        int[] taroCard = new int[CARDS];
        int[] hanaCard = new int[CARDS];
        int taroP = 0;
        int hanaP = 0;
        int shor;
        int lon;

        for (int i = INIT; i < delta; i++)
        {
            alpha = Console.ReadLine().Split(' ');
            taroHArr = alpha[0].ToCharArray();
            hanaArr = alpha[1].ToCharArray();
            int Tcount = taroHArr.Length;
            int Hcount = hanaArr.Length;
            for (int j = INIT; j < Tcount; j++)
            {
                taroCard[j] = taroHArr[j];
            }
            for (int j = INIT; j < Hcount; j++)
            {
                hanaCard[j] = hanaArr[j];
            }

            if (Hcount < Tcount)
            {
                shor = Hcount;
                lon = Tcount;
            }
            else if (Tcount < Hcount)
            {
                shor = Tcount;
                lon = Hcount;
            }
            else
            {
                shor = Hcount;
                lon = INIT;
            }

            for (int j = INIT; j < shor; ++j)
            {
                int moveck1 = hanaP;
                int moveck2 = taroP;

                if (taroCard[j] == hanaCard[j] && j == shor - ARRAYER)
                {
                    hanaP += manip.SameNumsCk(lon, Hcount, Tcount);
                    taroP += manip.SameNumsCk(lon, Tcount, Hcount);
                }
                //manip.Moveck(moveck1, hanaP); <--これをやりたいがやり方がわからない
                if (moveck1 != hanaP || moveck2 != taroP)
                {
                    break;
                }
                hanaP += manip.Dictionary(hanaCard[j], taroCard[j]);
                if (moveck1 != hanaP || moveck2 != taroP)
                {
                    break;
                }
                taroP += manip.Dictionary(taroCard[j], hanaCard[j]);
                if (moveck1 != hanaP || moveck2 != taroP)
                {
                    break;
                }
            }
        }
        Console.WriteLine("{0} {1}", taroP, hanaP);
    }
    class Manipulation
    {
        const int LOSE = 0;
        const int WIN = 3;
        const int DRAW = 1;
        internal int Dictionary(int WinnerCard, int LoserCard)
        {
            if (LoserCard < WinnerCard)
                return WIN;
            else
                return LOSE;

        }
        internal int SameNumsCk(int long1, int WinnerCount, int LoserCount)
        {
            if (long1 == WinnerCount)
                return WIN;
            else if (WinnerCount == LoserCount)
                return DRAW;
            else
                return LOSE;
        }
        //internal string MoveCk(int PrevPt,int NowPt)
        //{
        //    if (PrevPt != NowPt)
        //        return break;
        //    else
        //        return "";
        //}
    }
}


Measured memory_bytes: 17912