x, y = (int(s) for s in input().split())
while y > 0:
    x, y = y, x % y
print(x) int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s x, y = (int(s) for s in input().split()) x (int(s) for s in input().split()) y while y > 0:
    x, y = y, x % y y > 0 y 0 x, y = y, x % y x y y x % y x y print(x) print x x, y = y, x % y y x y = (int(s) for s in input().split()) (int(s) for s in input().split()) y y = y, x % y x % y y x, y = (int(s) for s in input().split()) (int(s) for s in input().split()) x
x, y = (int(s) for s in input().split())
while y > 0:
    x, y = y, x % y
print(x)