a = input().split()
x = int(a[0])
y = int(a[1])
while y:
    x, y = y, x%y
print(x) a = input().split() a input().split() ().split () input split x = int(a[0]) x int(a[0]) int a[0] a 0 y = int(a[1]) y int(a[1]) int a[1] a 1 while y:
    x, y = y, x%y y x, y = y, x%y x y y x%y x y print(x) print x x, y = y, x%y y x y = y, x%y x%y y x = int(a[0]) int(a[0]) x a = input().split() input().split() a y = int(a[1]) int(a[1]) y
a = input().split()
x = int(a[0])
y = int(a[1])
while y:
    x, y = y, x%y
print(x)