readInt :: String -> Int
readInt = read

main = do
 _ <- getLine
 arr <- (map readInt . words) <$> getLine
 let anss = foldr foo [2] arr
 if null anss then print(-1) else putStrLn(show (head anss)++" "++show(last anss))

type Cand = [Int]

analyze = undefined
-- reverse action
foo :: Int -> Cand -> Cand
foo divisor cand = [ c+rem | c <- newcand, rem <- [0..divisor-1] ]
 where newcand = [c | c <- cand, c `mod` divisor == 0]