import Control.Arrow
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
main=print.solve.unfoldr(B.readInt.B.dropWhile isSpace)=<<(B.getLine>>B.getLine)
solve=maximum.uncurry(zipWith gcd).(scanl gcd 0&&&tail.scanr gcd 0)