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

if a < b:
    a, b = b, a


while True:
    if b == 0:
        break
    tmp = a % b
    a = b
    b = tmp

print(a)
 a, b = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split b if a < b:
    a, b = b, a a < b a b a, b = b, a a b b a while True:
    if b == 0:
        break
    tmp = a % b
    a = b
    b = tmp True if b == 0:
        break
     b == 0 b 0 break tmp = a % b tmp a % b a b a = b a b b = tmp b tmp print(a) print a a, b = b, a b a b = tmp tmp b a, b = list(map(int, input().split())) list(map(int, input().split())) a b = list(map(int, input().split())) list(map(int, input().split())) b b = b, a a b a = b b a tmp = a % b a % b tmp
a, b = list(map(int, input().split()))

if a < b:
    a, b = b, a


while True:
    if b == 0:
        break
    tmp = a % b
    a = b
    b = tmp

print(a)

