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

if a > b:
    A = a
    B = b
else:
    A = b
    B = a

GCD = 1
while True:
    A, B = B, A%B
    
    if B == 0:
        break
    
print (str(A)) a, b = map(int, input().rstrip().split(" ")) a map(int, input().rstrip().split(" ")) map int input().rstrip().split(" ") ().rstrip().split ().rstrip() ().rstrip () input rstrip split " " b if a > b:
    A = a
    B = b
else:
    A = b
    B = a a > b a b A = a A a B = b B b A = b A b B = a B a GCD = 1 GCD 1 while True:
    A, B = B, A%B
    
    if B == 0:
        break
     True A, B = B, A%B A B B A%B A B if B == 0:
        break
     B == 0 B 0 break print (str(A)) print str(A) str A a, b = map(int, input().rstrip().split(" ")) map(int, input().rstrip().split(" ")) a B = a a B B = b b B B = B, A%B A%B B A = a a A b = map(int, input().rstrip().split(" ")) map(int, input().rstrip().split(" ")) b A = b b A A, B = B, A%B B A GCD = 1 1 GCD
a, b = map(int, input().rstrip().split(" "))

if a > b:
    A = a
    B = b
else:
    A = b
    B = a

GCD = 1
while True:
    A, B = B, A%B
    
    if B == 0:
        break
    
print (str(A))