module Main where
--import Debug.Trace
import Data.List
import Data.Char
import Data.Array
import Data.Maybe
import Data.Ord
import Control.Monad

solve :: [[String]] -> [Int]
solve = iter 0 0 where
    iter l r [] = [l, r]
    iter l r ([lw,rw]:ws)
        | lw > rw = iter (l+3) r ws
        | lw < rw = iter l (r+3) ws
        | otherwise = iter (l+1) (r+1) ws

readLine:: IO [Int]
readLine = fmap (map read . words) getLine

readLines :: Int -> IO [[String]]
readLines 0 = return []
readLines n = getLine >>= (\a -> fmap (words a:) (readLines (pred n)))
            
main :: IO() 
main = do
    [n] <- readLine
    l  <- readLines n
    putStrLn $ init $ foldl (\b n -> b++show n++" ") [] (solve l)

