a, b = [int(x) for x in input().split()]
while b:
    a, b = b, a % b
print(a) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x a, b = [int(x) for x in input().split()] a [int(x) for x in input().split()] b while b:
    a, b = b, a % b b a, b = b, a % b a b b a % b a b print(a) print a b = [int(x) for x in input().split()] [int(x) for x in input().split()] b a, b = [int(x) for x in input().split()] [int(x) for x in input().split()] a a, b = b, a % b b a b = b, a % b a % b b
a, b = [int(x) for x in input().split()]
while b:
    a, b = b, a % b
print(a)