#ALDS1_1-B Greatest Common Divisor
def gcd(x,y):
    if x%y == 0:
        print(y)
    else:
        gcd(y,x%y)

x,y = [int(x) for x in input().split()]
if x>y:
    gcd(x,y)
else:
    gcd(y,x) def gcd(x,y):
    if x%y == 0:
        print(y)
    else:
        gcd(y,x%y) gcd if x%y == 0:
        print(y)
    else:
        gcd(y,x%y) x%y == 0 x%y x y 0 print(y) print y gcd(y,x%y) gcd y x%y x y x x y y int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x x,y = [int(x) for x in input().split()] x [int(x) for x in input().split()] y if x>y:
    gcd(x,y)
else:
    gcd(y,x) x>y x y gcd(x,y) gcd x y gcd(y,x) gcd y x def gcd(x,y):
    if x%y == 0:
        print(y)
    else:
        gcd(y,x%y) def gcd(x,y):
    if x%y == 0:
        print(y)
    else:
        gcd(y,x%y) gcd x,y = [int(x) for x in input().split()] [int(x) for x in input().split()] x y = [int(x) for x in input().split()] [int(x) for x in input().split()] y
#ALDS1_1-B Greatest Common Divisor
def gcd(x,y):
    if x%y == 0:
        print(y)
    else:
        gcd(y,x%y)

x,y = [int(x) for x in input().split()]
if x>y:
    gcd(x,y)
else:
    gcd(y,x)