#include #define rep(i, n) for(int(i) = 0; (i) < (n); (i)++) #define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++) #define ALL(v) (v).begin(), (v).end() #define LLA(v) (v).rbegin(), (v).rend() #define SZ(v) (v).size() #define INT(...) \ int __VA_ARGS__; \ read(__VA_ARGS__) #define LL(...) \ ll __VA_ARGS__; \ read(__VA_ARGS__) #define DOUBLE(...) \ double __VA_ARGS__; \ read(__VA_ARGS__) #define CHAR(...) \ char __VA_ARGS__; \ read(__VA_ARGS__) #define STRING(...) \ string __VA_ARGS__; \ read(__VA_ARGS__) #define VEC(type, name, size) \ vector name(size); \ read(name) using namespace std; using ll = long long; using pii = pair; using pll = pair; using Graph = vector>; template struct edge { int to; T cost; edge(int t, T c) : to(t), cost(c) {} }; template using WGraph = vector>>; const int INF = 1 << 30; const ll LINF = 1LL << 60; const int MOD = 1e9 + 7; template inline vector make_vec(size_t a, T val) { return vector(a, val); } template inline auto make_vec(size_t a, Ts... ts) { return vector(a, make_vec(ts...)); } void read() {} template inline void read(T &a) { cin >> a; } template inline void read(pair &p) { read(p.first), read(p.second); } template inline void read(vector &v) { for(auto &a : v) read(a); } template inline void read(Head &head, Tail &... tail) { read(head), read(tail...); } template inline void chmax(T &a, T &b) { (a < b ? a = b : a); } template inline void chmin(T &a, T &b) { (a > b ? a = b : a); } // 素数篩+素因数分解 // 初期化O(N),素因数分解O(logN) // たくさん素因数分解するときはこっち #include struct prime_sieve { int N; vector sieve; prime_sieve(int n) : N(n + 1) { sieve.resize(N); iota(ALL(sieve), 0); init(); } void init() { for(int i = 2; i * i <= N; i++) { if(sieve[i] < i) continue; for(int j = i * i; j < N; j += i) { if(sieve[j] == j) sieve[j] = i; } } } map prime_factorize(ll n) { assert(n <= N); map ret; while(n > 1) { ret[sieve[n]]++; n = n / sieve[n]; } return ret; } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); INT(x); prime_sieve sieve(2000100); vector d(x + 1); d[1] = 1; for(int i = 2; i <= x; i++) { auto pf = sieve.prime_factorize(i); ll a = 1; for(auto [_, c] : pf) a *= (c + 1); d[i] = a; } vector res; int ans = INF; for(int i = 1; i <= x - 1; i++) { int tmp = abs(2 * i - x + d[x - i] - d[i]); if(tmp < ans) { res.clear(); res.emplace_back(i, x - i); ans = tmp; } else if(tmp == ans) { res.emplace_back(i, x - i); } } for(auto [a, b] : res) { cout << a << " " << b << endl; } }