
c,d = list(map(int,input().split()))

if d>c:
    a = d
    b = c
else:
     a = c
     b = d

def gcd(x,y):
    if y == 0:
        return x
    else:
        r = x%y
        return gcd(y,r)
    
print(gcd(a,b))
    
 c,d = list(map(int,input().split())) c list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split d if d>c:
    a = d
    b = c
else:
     a = c
     b = d d>c d c a = d a d b = c b c a = c a c b = d b d def gcd(x,y):
    if y == 0:
        return x
    else:
        r = x%y
        return gcd(y,r)
     gcd if y == 0:
        return x
    else:
        r = x%y
        return gcd(y,r)
     y == 0 y 0 return x x r = x%y r x%y x y return gcd(y,r) gcd(y,r) gcd y r x x y y print(gcd(a,b)) print gcd(a,b) gcd a b def gcd(x,y):
    if y == 0:
        return x
    else:
        r = x%y
        return gcd(y,r)
     def gcd(x,y):
    if y == 0:
        return x
    else:
        r = x%y
        return gcd(y,r)
     gcd a = c c a d = list(map(int,input().split())) list(map(int,input().split())) d a = d d a c,d = list(map(int,input().split())) list(map(int,input().split())) c b = d d b b = c c b

c,d = list(map(int,input().split()))

if d>c:
    a = d
    b = c
else:
     a = c
     b = d

def gcd(x,y):
    if y == 0:
        return x
    else:
        r = x%y
        return gcd(y,r)
    
print(gcd(a,b))
    

