def rec(n, arr)
  div = (2..(n**0.5).to_i).find { |i| n % i == 0 }
  return arr << n if div.nil?

  rec(n / div, arr << div)
end

gets
as = gets.split.map(&:to_i)

gcd = as.inject(:gcd)
as.map! { |a| a / gcd }

divisor = rec(as[0], []).sort.uniq
ans_without_a0 = as[1..-1].inject(:gcd)

deletes = []
divisor.each do |i|
  tmp = as.select { |a| a % i != 0 }
  deletes << tmp[0] if tmp.size == 1
end

ans = 1
deletes.each do |d|
  as_tmp = as.dup
  as_tmp.delete(d)
  ans = [as_tmp.inject(:gcd), ans].max
end
puts [ans, ans_without_a0].max * gcd
