s = input().split(" ")
x = int(s[0])
y = int(s[1])
while x != 0 and y != 0:
    if x >= y:
        x = x % y
    else:
        y = y % x
if x == 0:
    print(y)
else:
    print(x) s = input().split(" ") s input().split(" ") ().split () input split " " x = int(s[0]) x int(s[0]) int s[0] s 0 y = int(s[1]) y int(s[1]) int s[1] s 1 while x != 0 and y != 0:
    if x >= y:
        x = x % y
    else:
        y = y % x x != 0 and y != 0 x != 0 x 0 y != 0 y 0 if x >= y:
        x = x % y
    else:
        y = y % x x >= y x y x = x % y x x % y x y y = y % x y y % x y x if x == 0:
    print(y)
else:
    print(x) x == 0 x 0 print(y) print y print(x) print x x = x % y x % y x y = int(s[1]) int(s[1]) y s = input().split(" ") input().split(" ") s x = int(s[0]) int(s[0]) x y = y % x y % x y
s = input().split(" ")
x = int(s[0])
y = int(s[1])
while x != 0 and y != 0:
    if x >= y:
        x = x % y
    else:
        y = y % x
if x == 0:
    print(y)
else:
    print(x)