a, b = map(int, input().split())
c =1
if b > a:
    a, b = b, a
while c != 0:
    c = a % b
    a = b
    b = c
print(a) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b c =1 c 1 if b > a:
    a, b = b, a b > a b a a, b = b, a a b b a while c != 0:
    c = a % b
    a = b
    b = c c != 0 c 0 c = a % b c a % b a b a = b a b b = c b c print(a) print a c =1 1 c c = a % b a % b c a, b = map(int, input().split()) map(int, input().split()) a a, b = b, a b a b = c c b a = b b a b = map(int, input().split()) map(int, input().split()) b b = b, a a b
a, b = map(int, input().split())
c =1
if b > a:
    a, b = b, a
while c != 0:
    c = a % b
    a = b
    b = c
print(a)