x, y = map(int, input().split())


def gcd(x, y):
    if x % y == 0:
        return y
    elif x % y == 1:
        return 1
    else:
        return gcd(y, x % y)

if x >= y:
    n = gcd(x, y)
    print(n)
else:
    n = gcd(y, x)
    print(n) x, y = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split y def gcd(x, y):
    if x % y == 0:
        return y
    elif x % y == 1:
        return 1
    else:
        return gcd(y, x % y) gcd if x % y == 0:
        return y
    elif x % y == 1:
        return 1
    else:
        return gcd(y, x % y) x % y == 0 x % y x y 0 return y y elif x % y == 1:
        return 1
     x % y == 1 x % y x y 1 return 1 1 return gcd(y, x % y) gcd(y, x % y) gcd y x % y x y x x y y if x >= y:
    n = gcd(x, y)
    print(n)
else:
    n = gcd(y, x)
    print(n) x >= y x y n = gcd(x, y) n gcd(x, y) gcd x y print(n) print n n = gcd(y, x) n gcd(y, x) gcd y x print(n) print n def gcd(x, y):
    if x % y == 0:
        return y
    elif x % y == 1:
        return 1
    else:
        return gcd(y, x % y) def gcd(x, y):
    if x % y == 0:
        return y
    elif x % y == 1:
        return 1
    else:
        return gcd(y, x % y) gcd n = gcd(x, y) gcd(x, y) n n = gcd(y, x) gcd(y, x) n y = map(int, input().split()) map(int, input().split()) y x, y = map(int, input().split()) map(int, input().split()) x
x, y = map(int, input().split())


def gcd(x, y):
    if x % y == 0:
        return y
    elif x % y == 1:
        return 1
    else:
        return gcd(y, x % y)

if x >= y:
    n = gcd(x, y)
    print(n)
else:
    n = gcd(y, x)
    print(n)