a,b=[int(x) for x in input().split()]

x = max(a,b)
y = min(a,b)
res = y

while x%y>0:
    res = x%y
    x = y
    y = res

print(res) 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 x = max(a,b) x max(a,b) max a b y = min(a,b) y min(a,b) min a b res = y res y while x%y>0:
    res = x%y
    x = y
    y = res x%y>0 x%y x y 0 res = x%y res x%y x y x = y x y y = res y res print(res) print res x = y y x x = max(a,b) max(a,b) x b=[int(x) for x in input().split()] [int(x) for x in input().split()] b res = x%y x%y res y = min(a,b) min(a,b) y y = res res y a,b=[int(x) for x in input().split()] [int(x) for x in input().split()] a res = y y res
a,b=[int(x) for x in input().split()]

x = max(a,b)
y = min(a,b)
res = y

while x%y>0:
    res = x%y
    x = y
    y = res

print(res)