import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V
import Debug.Trace
main :: IO ()
main = getLine >> readLine >>= print . solve

solve :: [Int] -> Int
solve (a : as) = maximum . take n . map mf $ zip cs ds
    where
        n = length $ a : as
        (b : bs) = reverse $ a : as
        vs = build a as
        rs = tail . reverse $ build b bs

        cs = head rs : vs
        ds = rs ++ [vs !! (n - 2)]

        mf (v, r) = gcd v r

        build p (x : xs) = p : build (gcd p x) xs
        build p _ = [p]


readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine