main :: IO ()
main = interact $ (++ "\n") . unwords . map show . (\(ts,hs) -> [sum ts, sum hs]) . unzip . map (score . words) . tail . lines

score :: [String] -> (Int, Int)
score [t,h] = case compare t h of GT -> (3,0); EQ -> (1,1); LT -> (0,3)
