import Control.Applicative

main :: IO ()
main = do
  ns <- map words . lines
        <$> getContents
  mapM_ (print . f) ns

f :: [String] -> Int
f (x:y:_) = gcd' (read x) (read y)

gcd' :: Int -> Int -> Int
gcd' x y = go (max x y) (min x y)
  where
    go a b 
      | b == 0 = a
      | otherwise = go b (a `mod` b)