#include <bits/stdc++.h>
int main() {
  long N, P;
  int ret;
  long mgcm;
  ret = scanf("%ld%ld", &N, &P);
  if (ret == EOF) return -1;
  long fin = (long)pow(P, 1.0 / N);
  printf("%ld\n", fin);
  double dst;
  long out = 1;
  mgcm = 2;
  while (mgcm <= fin) {
    dst = (double)P;
    for (int i = 0; i < N; i++) {
      dst = dst / mgcm;
    }
    if ((long)dst == dst) {
      out = mgcm;
    }
    mgcm++;
  }
  printf("%ld\n", out);
  return 0;
}
