line=input().split()
x=int(line[0])
y=int(line[1])
def gcd(x,y):
    r=x%y
    while(r>0):
        x=y
        y=r
        r=x%y
    return y
    
print (gcd(x,y))
 line=input().split() line input().split() ().split () input split x=int(line[0]) x int(line[0]) int line[0] line 0 y=int(line[1]) y int(line[1]) int line[1] line 1 def gcd(x,y):
    r=x%y
    while(r>0):
        x=y
        y=r
        r=x%y
    return y
     gcd r=x%y r x%y x y while(r>0):
        x=y
        y=r
        r=x%y
     r>0 r 0 x=y x y y=r y r r=x%y r x%y x y return y y x x y y print (gcd(x,y)) print gcd(x,y) gcd x y y=int(line[1]) int(line[1]) y line=input().split() input().split() line def gcd(x,y):
    r=x%y
    while(r>0):
        x=y
        y=r
        r=x%y
    return y
     def gcd(x,y):
    r=x%y
    while(r>0):
        x=y
        y=r
        r=x%y
    return y
     gcd x=int(line[0]) int(line[0]) x
line=input().split()
x=int(line[0])
y=int(line[1])
def gcd(x,y):
    r=x%y
    while(r>0):
        x=y
        y=r
        r=x%y
    return y
    
print (gcd(x,y))

