from collections import defaultdict

from math import sqrt

N,P = list(map(int, input().split()))

is_prime = [True]*(10**6+1)

is_prime[0] = is_prime[1] = False

def sieve(n:int):

    """Sieve of Eratoshenes

    return the number of prime number (0, n]"""

    global is_prime

    for i in range(2, n+1):

        if is_prime[i]:

            # 素数の倍数は合成数

            for j in range(i*2, n+1, i):

                is_prime[j] = False



sieve(10**6)

facts = defaultdict(lambda:0)

p = P

for i in range(int(sqrt(P))):

    if not is_prime[i]:

        continue

    if p == 1:

        break

    while p % i == 0:

        p //= i

        facts[i] += 1

if p>0:

    facts[p] += 1

ans = 1

for k,v in list(facts.items()):

    ans *= pow(k, v//N)

print(ans)

from collections import defaultdict

from math import sqrt

N,P = list(map(int, input().split()))



def factorize(a:int):

    """prime factorization O(sqrt(N))

    return dict of prime factor

    """

    ps = {}

    i = 2

    nokori = a

    while i*i <= nokori:

        if nokori%i==0:

            cnt = 0

            while nokori%i==0:

                cnt += 1

                nokori //= i

            ps[i] = cnt

        i += 1

    if nokori != 1:

        ps[nokori] = 1

    return ps



ps = factorize(P)

# print(ps)

ans = 1

for k,v in list(ps.items()):

    ans *= pow(k, v//N)

print(ans)

from collections import defaultdict
from math import sqrt

N, P = list(map(int, input().split()))
is_prime = [True] * (10**6 + 1)
is_prime[0] = is_prime[1] = False


def sieve(n: int):
    """Sieve of Eratoshenes
    return the number of prime number (0, n]"""
    global is_prime
    for i in range(2, n + 1):
        if is_prime[i]:
            # 素数の倍数は合成数
            for j in range(i * 2, n + 1, i):
                is_prime[j] = False


sieve(10**6)
facts = defaultdict(lambda: 0)
p = P
for i in range(int(sqrt(P))):
    if not is_prime[i]:
        continue
    if p == 1:
        break
    while p % i == 0:
        p //= i
        facts[i] += 1
if p > 0:
    facts[p] += 1
ans = 1
for k, v in list(facts.items()):
    ans *= pow(k, v // N)
print(ans)

from collections import defaultdict
from math import sqrt

N, P = list(map(int, input().split()))


def factorize(a: int):
    """prime factorization O(sqrt(N))
    return dict of prime factor
    """
    ps = {}
    i = 2
    nokori = a
    while i * i <= nokori:
        if nokori % i == 0:
            cnt = 0
            while nokori % i == 0:
                cnt += 1
                nokori //= i
            ps[i] = cnt
        i += 1
    if nokori != 1:
        ps[nokori] = 1
    return ps


ps = factorize(P)
# print(ps)
ans = 1
for k, v in list(ps.items()):
    ans *= pow(k, v // N)
print(ans)

-is_prime = [True] * (10**6 + 1) -is_prime[0] = is_prime[1] = False -def sieve(n: int): -    """Sieve of Eratoshenes -    return the number of prime number (0, n]""" -    global is_prime -    for i in range(2, n + 1): -        if is_prime[i]: -            # 素数の倍数は合成数 -            for j in range(i * 2, n + 1, i): -                is_prime[j] = False +def factorize(a: int): +    """prime factorization O(sqrt(N)) +    return dict of prime factor +    """ +    ps = {} +    i = 2 +    nokori = a +    while i * i <= nokori: +        if nokori % i == 0: +            cnt = 0 +            while nokori % i == 0: +                cnt += 1 +                nokori //= i +            ps[i] = cnt +        i += 1 +    if nokori != 1: +        ps[nokori] = 1 +    return ps -sieve(10**6) -facts = defaultdict(lambda: 0) -p = P -for i in range(int(sqrt(P))): -    if not is_prime[i]: -        continue -    if p == 1: -        break -    while p % i == 0: -        p //= i -        facts[i] += 1 -if p > 0: -    facts[p] += 1 +ps = factorize(P) +# print(ps) -for k, v in list(facts.items()): +for k, v in list(ps.items()):