import fractions

a,b=list(map(int,input().split()))

b//=fractions.gcd(a,b)

a,c=2,1

while a**2<=b:

    if b%a==0:

        c*=a

        while b%a==0: b//=a

    a+=1

print((c*b))
def gcd(a, b):

    while b: a, b = b, a % b

    return a



a,b=list(map(int,input().split()))

b//=gcd(a,b)

a,c=2,1

while a*a<=b:

    if b%a==0:

        c*=a

        while b%a==0:b//=a

    a+=1

print(([c*b,c][b==1]))
import fractions

a, b = list(map(int, input().split()))
b //= fractions.gcd(a, b)
a, c = 2, 1
while a**2 <= b:
    if b % a == 0:
        c *= a
        while b % a == 0:
            b //= a
    a += 1
print((c * b))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


a, b = list(map(int, input().split()))
b //= gcd(a, b)
a, c = 2, 1
while a * a <= b:
    if b % a == 0:
        c *= a
        while b % a == 0:
            b //= a
    a += 1
print(([c * b, c][b == 1]))

-import fractions +def gcd(a, b): +    while b: +        a, b = b, a % b +    return a + -b //= fractions.gcd(a, b) +b //= gcd(a, b) -while a**2 <= b: +while a * a <= b: -print((c * b)) +print(([c * b, c][b == 1]))