a, b = map(int, input().split())

if a < b:
    t = a
    a = b
    b = t
while b != 0 and b <= a:
    t = a % b
    a = b
    b = t

print(a) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b if a < b:
    t = a
    a = b
    b = t a < b a b t = a t a a = b a b b = t b t while b != 0 and b <= a:
    t = a % b
    a = b
    b = t b != 0 and b <= a b != 0 b 0 b <= a b a t = a % b t a % b a b a = b a b b = t b t print(a) print a b = map(int, input().split()) map(int, input().split()) b a = b b a a, b = map(int, input().split()) map(int, input().split()) a t = a % b a % b t a = b b a t = a a t b = t t b b = t t b
a, b = map(int, input().split())

if a < b:
    t = a
    a = b
    b = t
while b != 0 and b <= a:
    t = a % b
    a = b
    b = t

print(a)