a, b = map(int, input().split())
c = []
if a > b:
    a, b = b, a
if b%a == 0:
    print(a)
else:
    while True:
        for i in range(a):
            x = i + 2
            #print(a, x)
            if a%x == 0:
                if b%x == 0:
                    c.append(x)
                    a = a//x
                    b = b//x
                    #print(c)
                    break
                elif b%(a//x) == 0:
                    c.append(a//x)
                    a = x
                    b = b//(a//x)
                    #print(c)
                    break
            #if x%1000 == 0:
                #print(x)
            if x > a**0.5:
                break
        if x > a**0.5:
            break
    s = 1
    for j in c:
        s = s * j
    print(s)
 a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b c = [] c [] if a > b:
    a, b = b, a a > b a b a, b = b, a a b b a if b%a == 0:
    print(a)
else:
    while True:
        for i in range(a):
            x = i + 2
            #print(a, x)
            if a%x == 0:
                if b%x == 0:
                    c.append(x)
                    a = a//x
                    b = b//x
                    #print(c)
                    break
                elif b%(a//x) == 0:
                    c.append(a//x)
                    a = x
                    b = b//(a//x)
                    #print(c)
                    break
            #if x%1000 == 0:
                #print(x)
            if x > a**0.5:
                break
        if x > a**0.5:
            break
    s = 1
    for j in c:
        s = s * j
    print(s) b%a == 0 b%a b a 0 print(a) print a while True:
        for i in range(a):
            x = i + 2
            #print(a, x)
            if a%x == 0:
                if b%x == 0:
                    c.append(x)
                    a = a//x
                    b = b//x
                    #print(c)
                    break
                elif b%(a//x) == 0:
                    c.append(a//x)
                    a = x
                    b = b//(a//x)
                    #print(c)
                    break
            #if x%1000 == 0:
                #print(x)
            if x > a**0.5:
                break
        if x > a**0.5:
            break
     True for i in range(a):
            x = i + 2
            #print(a, x)
            if a%x == 0:
                if b%x == 0:
                    c.append(x)
                    a = a//x
                    b = b//x
                    #print(c)
                    break
                elif b%(a//x) == 0:
                    c.append(a//x)
                    a = x
                    b = b//(a//x)
                    #print(c)
                    break
            #if x%1000 == 0:
                #print(x)
            if x > a**0.5:
                break
         i range(a) range a x = i + 2 x i + 2 i 2 if a%x == 0:
                if b%x == 0:
                    c.append(x)
                    a = a//x
                    b = b//x
                    #print(c)
                    break
                elif b%(a//x) == 0:
                    c.append(a//x)
                    a = x
                    b = b//(a//x)
                    #print(c)
                    break
            #if x%1000 == 0:
                #print(x)
             a%x == 0 a%x a x 0 if b%x == 0:
                    c.append(x)
                    a = a//x
                    b = b//x
                    #print(c)
                    break
                elif b%(a//x) == 0:
                    c.append(a//x)
                    a = x
                    b = b//(a//x)
                    #print(c)
                    break
            #if x%1000 == 0:
                #print(x)
             b%x == 0 b%x b x 0 c.append(x) c.append c append x a = a//x a a//x a x b = b//x b b//x b x break elif b%(a//x) == 0:
                    c.append(a//x)
                    a = x
                    b = b//(a//x)
                    #print(c)
                    break
            #if x%1000 == 0:
                #print(x)
             b%(a//x) == 0 b%(a//x) b a//x a x 0 c.append(a//x) c.append c append a//x a x a = x a x b = b//(a//x) b b//(a//x) b a//x a x break if x > a**0.5:
                break
         x > a**0.5 x a**0.5 a 0.5 break if x > a**0.5:
            break
     x > a**0.5 x a**0.5 a 0.5 break s = 1 s 1 for j in c:
        s = s * j
     j c s = s * j s s * j s j print(s) print s a, b = map(int, input().split()) map(int, input().split()) a b = b//x b//x b b = map(int, input().split()) map(int, input().split()) b a, b = b, a b a c = [] [] c b = b//(a//x) b//(a//x) b a = x x a b = b, a a b s = 1 1 s x = i + 2 i + 2 x a = a//x a//x a s = s * j s * j s
a, b = map(int, input().split())
c = []
if a > b:
    a, b = b, a
if b%a == 0:
    print(a)
else:
    while True:
        for i in range(a):
            x = i + 2
            #print(a, x)
            if a%x == 0:
                if b%x == 0:
                    c.append(x)
                    a = a//x
                    b = b//x
                    #print(c)
                    break
                elif b%(a//x) == 0:
                    c.append(a//x)
                    a = x
                    b = b//(a//x)
                    #print(c)
                    break
            #if x%1000 == 0:
                #print(x)
            if x > a**0.5:
                break
        if x > a**0.5:
            break
    s = 1
    for j in c:
        s = s * j
    print(s)

