gets
A = gets.split(' ').map(&:to_i)

nums = A.combination(2).map { |a, b| [a.gcd(b), a, b] }
max, * = nums.max_by { |n, *| n }

(_, *a), (_, *b) = nums.reject { |n, *| n == max }
if a.empty?
  puts max
  exit
end
