x, y = [int(a) for a in input().split()]

def divisor(x, y):
    while x % y != 0:
        amari = x % y
        if amari == 0:
            return y
        x = y
        y = amari
    return y
print(divisor(x, y)) int(a) for a in input().split() for a in input().split() a input().split() ().split () input split for a in input().split() int(a) int a x, y = [int(a) for a in input().split()] x [int(a) for a in input().split()] y def divisor(x, y):
    while x % y != 0:
        amari = x % y
        if amari == 0:
            return y
        x = y
        y = amari
    return y divisor while x % y != 0:
        amari = x % y
        if amari == 0:
            return y
        x = y
        y = amari
     x % y != 0 x % y x y 0 amari = x % y amari x % y x y if amari == 0:
            return y
         amari == 0 amari 0 return y y x = y x y y = amari y amari return y y x x y y print(divisor(x, y)) print divisor(x, y) divisor x y def divisor(x, y):
    while x % y != 0:
        amari = x % y
        if amari == 0:
            return y
        x = y
        y = amari
    return y def divisor(x, y):
    while x % y != 0:
        amari = x % y
        if amari == 0:
            return y
        x = y
        y = amari
    return y divisor y = [int(a) for a in input().split()] [int(a) for a in input().split()] y x, y = [int(a) for a in input().split()] [int(a) for a in input().split()] x
x, y = [int(a) for a in input().split()]

def divisor(x, y):
    while x % y != 0:
        amari = x % y
        if amari == 0:
            return y
        x = y
        y = amari
    return y
print(divisor(x, y))