while str = gets
  break if str =~ /EOF/
  buf = str.split.sort.collect{|num| num.to_i}
  loop do
    remainder = buf[1] % buf[0]
    if remainder == 0
      puts buf[0]
      break
    end
    buf[1] = buf[0]
    buf[0] = remainder
  end
end