def calc_gcd(a, b)
  if b > a
    a, b = b, a
  end
  loop do
    r = a % b
    break if r == 0
    a, b = b, r
  end
  
  b
end

while line = gets
  a, b = line.split.map(&:to_i)
  puts calc_gcd(a, b)
end