def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table


cnt=1
gcd=1
b,p=map(int,input().split())
a=prime_decomposition(p)
print(a)
if b==1:

if b>1:
  l=len(a)
  for i in range(l-1):
    if a[i+1]==a[i]:
      cnt+=1
      if cnt==b:
        gcd*=a[i]
        cnt=1
    else:
      cnt=1
  print(gcd)
