#include #include #include //using namespace chrono; #include using namespace atcoder; #define int long long #define double long double #define stoi stoll //#define endl "\n" using std::abs; using namespace std; constexpr double PI = 3.14159265358979323846; const int INF = 1LL << 62; #define rep(i,n) for(int i=0;i=0;i--) #define Rrep(i,n) for(int i=n;i>0;i--) #define frep(i,n) for(auto &x:n) #define LAST(x) x[x.size()-1] #define ALL(x) (x).begin(),(x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x) #define RUD(a,b) (((a)+(b)-1)/(b)) #define sum1_n(n) ((n)*(n+1)/2) #define SUM1n2(n) (n*(2*n+1)*(n+1))/6 #define SUMkn(k,n) (SUM1n(n)-SUM1n(k-1)) #define SZ(x) ((int)(x).size()) #define PB push_back #define Fi first #define Se second #define lower(vec, i) *lower_bound(ALL(vec), i) #define upper(vec, i) *upper_bound(ALL(vec), i) #define lower_count(vec, i) (int)(lower_bound(ALL(vec), i) - (vec).begin()) #define acc(vec) accumulate(ALL(vec),0LL) template constexpr auto min(T... a) { return min(initializer_list>{a...}); } template constexpr auto max(T... a) { return max(initializer_list>{a...}); } template void in(T&... a) { (cin >> ... >> a); } int ini() { int x; cin >> x; return x; } string ins() { string x; cin >> x; return x; } template using v = vector; template using vv = vector>; template using vvv = vector>; using pint = pair; using tint = tuple; using qint = tuple; double LOG(int a, int b) { return log(b) / log(a); } double DISTANCE(int x1, int y1, int x2, int y2) { return sqrt(abs(x1 - x2) * abs(x1 - x2) + abs(y1 - y2) * abs(y1 - y2)); } inline bool BETWEEN(int x, int min, int max) { if (min <= x && x <= max) return true; else return false; } inline bool between(int x, int min, int max) { if (min < x && x < max) return true; else return false; } inline bool BETWEEN2(int i, int j, int H, int W) { if (BETWEEN(i, 0, H - 1) && BETWEEN(j, 0, W - 1)) return true; else return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } inline bool bit(int x, int i) { return x >> i & 1; } void yn(bool x) { if (x) { cout << "Yes" << endl; } else { cout << "No" << endl; } } void YN(bool x) { if (x) { cout << "YES" << endl; } else { cout << "NO" << endl; } } int ipow(int x, int n) { int ans = 1; while (n > 0) { if (n & 1) ans *= x; x *= x; n >>= 1; } return ans; } template vector compress(vector& X) { vector vals = X; sort(ALL(vals)); vals.erase(unique(ALL(vals)), vals.end()); rep(i, SZ(X)) X[i] = lower_bound(ALL(vals), X[i]) - vals.begin(); return vals; } v prime_factorize(int N) { v res; for (int i = 2; i * i <= N; i++) { if (N % i != 0) continue; int ex = 0; while (N % i == 0) { ++ex; N /= i; } res.push_back({ i, ex }); } if (N != 1) res.push_back({ N, 1 }); return res; } struct Eratosthenes { v isprime; v minfactor; Eratosthenes(int N) : isprime(N + 1, true), minfactor(N + 1, -1) { isprime[0] = false; isprime[1] = false; minfactor[1] = 1; for (int p = 2; p <= N; ++p) { if (!isprime[p]) continue; minfactor[p] = p; for (int q = p * 2; q <= N; q += p) { isprime[q] = false; if (minfactor[q] == -1) minfactor[q] = p; } } } v factorize(int n) { v res; while (n > 1) { int p = minfactor[n]; int exp = 0; while (minfactor[n] == p) { n /= p; ++exp; } res.emplace_back(p, exp); } return res; } }; int number_of_divisors(v p) { int ans = 1; for (pint x : p) { ans *= x.second + 1; } return ans; } int sum_of_divisors(v p) { int ans = 1; for (pint x : p) { } return ans; } //constexpr int MOD = 1000000007; //constexpr int MOD = 998244353; //using mint = modint1000000007; //using mint = modint998244353; //using mint = static_modint<1000003>; #line 2 "prime/fast-factorize.hpp" #line 2 "inner/inner_math.hpp" namespace inner { using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; template T gcd(T a, T b) { while (b) swap(a %= b, b); return a; } template T inv(T a, T p) { T b = p, x = 1, y = 0; while (a) { T q = b / a; swap(a, b %= a); swap(x, y -= q * x); } assert(b == 1); return y < 0 ? y + p : y; } template T modpow(T a, U n, T p) { T ret = 1 % p; for (; n; n >>= 1, a = U(a) * a % p) if (n & 1) ret = U(ret) * a % p; return ret; } } // namespace inner #line 2 "misc/rng.hpp" namespace my_rand { using i64 = long long; using u64 = unsigned long long; // [0, 2^64 - 1) u64 rng() { static u64 _x = u64(chrono::duration_cast( chrono::high_resolution_clock::now().time_since_epoch()) .count()) * 10150724397891781847ULL; _x ^= _x << 7; return _x ^= _x >> 9; } // [l, r] i64 rng(i64 l, i64 r) { assert(l <= r); return l + rng() % (r - l + 1); } // [l, r) i64 randint(i64 l, i64 r) { assert(l < r); return l + rng() % (r - l); } // choose n numbers from [l, r) without overlapping vector randset(i64 l, i64 r, i64 n) { assert(l <= r && n <= r - l); unordered_set s; for (i64 i = n; i; --i) { i64 m = randint(l, r + 1 - i); if (s.find(m) != s.end()) m = r - i; s.insert(m); } vector ret; for (auto& x : s) ret.push_back(x); return ret; } // [0.0, 1.0) double rnd() { return rng() * 5.42101086242752217004e-20; } template void randshf(vector& v) { int n = v.size(); for (int i = 1; i < n; i++) swap(v[i], v[randint(0, i + 1)]); } } // namespace my_rand using my_rand::randint; using my_rand::randset; using my_rand::randshf; using my_rand::rnd; using my_rand::rng; #line 2 "modint/arbitrary-prime-modint.hpp" struct ArbitraryLazyMontgomeryModInt { using mint = ArbitraryLazyMontgomeryModInt; using i32 = int32_t; using u32 = uint32_t; using u64 = uint64_t; static u32 mod; static u32 r; static u32 n2; static u32 get_r() { u32 ret = mod; for (i32 i = 0; i < 4; ++i) ret *= 2 - mod * ret; return ret; } static void set_mod(u32 m) { assert(m < (1 << 30)); assert((m & 1) == 1); mod = m; n2 = -u64(m) % m; r = get_r(); assert(r * mod == 1); } u32 a; ArbitraryLazyMontgomeryModInt() : a(0) {} ArbitraryLazyMontgomeryModInt(const int64_t& b) : a(reduce(u64(b% mod + mod)* n2)) {}; static u32 reduce(const u64& b) { return (b + u64(u32(b) * u32(-r)) * mod) >> 32; } mint& operator+=(const mint& b) { if (i32(a += b.a - 2 * mod) < 0) a += 2 * mod; return *this; } mint& operator-=(const mint& b) { if (i32(a -= b.a) < 0) a += 2 * mod; return *this; } mint& operator*=(const mint& b) { a = reduce(u64(a) * b.a); return *this; } mint& operator/=(const mint& b) { *this *= b.inverse(); return *this; } mint operator+(const mint& b) const { return mint(*this) += b; } mint operator-(const mint& b) const { return mint(*this) -= b; } mint operator*(const mint& b) const { return mint(*this) *= b; } mint operator/(const mint& b) const { return mint(*this) /= b; } bool operator==(const mint& b) const { return (a >= mod ? a - mod : a) == (b.a >= mod ? b.a - mod : b.a); } bool operator!=(const mint& b) const { return (a >= mod ? a - mod : a) != (b.a >= mod ? b.a - mod : b.a); } mint operator-() const { return mint() - mint(*this); } mint pow(u64 n) const { mint ret(1), mul(*this); while (n > 0) { if (n & 1) ret *= mul; mul *= mul; n >>= 1; } return ret; } friend ostream& operator<<(ostream& os, const mint& b) { return os << b.get(); } friend istream& operator>>(istream& is, mint& b) { int64_t t; is >> t; b = ArbitraryLazyMontgomeryModInt(t); return (is); } mint inverse() const { return pow(mod - 2); } u32 get() const { u32 ret = reduce(a); return ret >= mod ? ret - mod : ret; } static u32 get_mod() { return mod; } }; typename ArbitraryLazyMontgomeryModInt::u32 ArbitraryLazyMontgomeryModInt::mod; typename ArbitraryLazyMontgomeryModInt::u32 ArbitraryLazyMontgomeryModInt::r; typename ArbitraryLazyMontgomeryModInt::u32 ArbitraryLazyMontgomeryModInt::n2; #line 2 "modint/modint-montgomery64.hpp" struct montgomery64 { using mint = montgomery64; using i64 = int64_t; using u64 = uint64_t; using u128 = __uint128_t; static u64 mod; static u64 r; static u64 n2; static u64 get_r() { u64 ret = mod; for (i64 i = 0; i < 5; ++i) ret *= 2 - mod * ret; return ret; } static void set_mod(u64 m) { assert(m < (1LL << 62)); assert((m & 1) == 1); mod = m; n2 = -u128(m) % m; r = get_r(); assert(r * mod == 1); } u64 a; montgomery64() : a(0) {} montgomery64(const int64_t& b) : a(reduce((u128(b) + mod)* n2)) {}; static u64 reduce(const u128& b) { return (b + u128(u64(b) * u64(-r)) * mod) >> 64; } mint& operator+=(const mint& b) { if (i64(a += b.a - 2 * mod) < 0) a += 2 * mod; return *this; } mint& operator-=(const mint& b) { if (i64(a -= b.a) < 0) a += 2 * mod; return *this; } mint& operator*=(const mint& b) { a = reduce(u128(a) * b.a); return *this; } mint& operator/=(const mint& b) { *this *= b.inverse(); return *this; } mint operator+(const mint& b) const { return mint(*this) += b; } mint operator-(const mint& b) const { return mint(*this) -= b; } mint operator*(const mint& b) const { return mint(*this) *= b; } mint operator/(const mint& b) const { return mint(*this) /= b; } bool operator==(const mint& b) const { return (a >= mod ? a - mod : a) == (b.a >= mod ? b.a - mod : b.a); } bool operator!=(const mint& b) const { return (a >= mod ? a - mod : a) != (b.a >= mod ? b.a - mod : b.a); } mint operator-() const { return mint() - mint(*this); } mint pow(u128 n) const { mint ret(1), mul(*this); while (n > 0) { if (n & 1) ret *= mul; mul *= mul; n >>= 1; } return ret; } friend ostream& operator<<(ostream& os, const mint& b) { return os << b.get(); } friend istream& operator>>(istream& is, mint& b) { int64_t t; is >> t; b = montgomery64(t); return (is); } mint inverse() const { return pow(mod - 2); } u64 get() const { u64 ret = reduce(a); return ret >= mod ? ret - mod : ret; } static u64 get_mod() { return mod; } }; typename montgomery64::u64 montgomery64::mod, montgomery64::r, montgomery64::n2; #line 7 "prime/fast-factorize.hpp" namespace fast_factorize { using u64 = uint64_t; template bool miller_rabin(u64 n, vector as) { if (mint::get_mod() != n) mint::set_mod(n); u64 d = n - 1; while (~d & 1) d >>= 1; mint e{ 1 }, rev{ int64_t(n - 1) }; for (u64 a : as) { if (n <= a) break; u64 t = d; mint y = mint(a).pow(t); while (t != n - 1 && y != e && y != rev) { y *= y; t *= 2; } if (y != rev && t % 2 == 0) return false; } return true; } bool is_prime(u64 n) { if (~n & 1) return n == 2; if (n <= 1) return false; if (n < (1LL << 30)) return miller_rabin(n, { 2, 7, 61 }); else return miller_rabin( n, { 2, 325, 9375, 28178, 450775, 9780504, 1795265022 }); } template T pollard_rho(T n) { if (~n & 1) return 2; if (is_prime(n)) return n; if (mint::get_mod() != n) mint::set_mod(n); mint R, one = 1; auto f = [&](mint x) { return x * x + R; }; auto rnd_ = [&]() { return rng() % (n - 2) + 2; }; while (1) { mint x, y, ys, q = one; R = rnd_(), y = rnd_(); T g = 1; constexpr int m = 128; for (int r = 1; g == 1; r <<= 1) { x = y; for (int i = 0; i < r; ++i) y = f(y); for (int k = 0; g == 1 && k < r; k += m) { ys = y; for (int i = 0; i < m && i < r - k; ++i) q *= x - (y = f(y)); g = inner::gcd(q.get(), n); } } if (g == n) do g = inner::gcd((x - (ys = f(ys))).get(), n); while (g == 1); if (g != n) return g; } exit(1); } using i64 = long long; vector inner_factorize(u64 n) { if (n <= 1) return {}; u64 p; if (n <= (1LL << 30)) p = pollard_rho(n); else p = pollard_rho(n); if (p == n) return { i64(p) }; auto l = inner_factorize(p); auto r = inner_factorize(n / p); copy(begin(r), end(r), back_inserter(l)); return l; } vector factorize(u64 n) { auto ret = inner_factorize(n); sort(begin(ret), end(ret)); return ret; } map factor_count(u64 n) { map mp; for (auto& x : factorize(n)) mp[x]++; return mp; } vector divisors(u64 n) { if (n == 0) return {}; vector> v; for (auto& p : factorize(n)) { if (v.empty() || v.back().first != p) { v.emplace_back(p, 1); } else { v.back().second++; } } vector ret; auto f = [&](auto rc, int i, i64 x) -> void { if (i == (int)v.size()) { ret.push_back(x); return; } for (int j = v[i].second;; --j) { rc(rc, i + 1, x); if (j == 0) break; x *= v[i].first; } }; f(f, 0, 1); sort(begin(ret), end(ret)); return ret; } } // namespace fast_factorize using fast_factorize::divisors; using fast_factorize::factor_count; using fast_factorize::factorize; using fast_factorize::is_prime; /** * @brief 高速素因数分解(Miller Rabin/Pollard's Rho) * @docs docs/prime/fast-factorize.md */ void solve() { int N = ini(); auto p = factor_count(N); int a = 1, b = 1; for (auto x : p) { if (x.second % 2 == 1)a *= x.first; b *= ipow(x.first, x.second / 2); } cout << b << " " << a; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(14); //cout << setfill('0') << right << setw(4)<< solve(); }