require 'set'
gets
a = gets.split.map(&:to_i)

s1 = Set.new
s1 << [a[0], false]
s1 << [a[1], false]

a.each do |i|
  s2 = Set.new
  s1.each do |j|
    if j[1]
      s2 << [j[0].gcd(i), true]
    else
	    s2 << [j[0], true]
    	s2 << [j[0].gcd(i), false]
    end
  end
  s1 = s2
end

p s1.select{|e|e[1]}.max_by{|e|e[0]}[0]

