while s = gets
   if s == nil
     break
   end
   s = s.split()
   a = s[0].to_i
   b = s[1].to_i
   i = 1
   while i <= a
     if a % i == 0 && b % (a/i) == 0
       break
     end
     i+=1
   end
   puts a/i
end