#include #define REP(i, n) for(int i = 0;i < n;i++) #define ll long long using namespace std; //typedef vectorvec; //typedef vectorvec; //typedef vector mat; typedef pair P; typedef pair LP; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const int INF = 1000000000; const ll LINF = 1000000000000000000;//1e18 const ll MOD = 1000000007; const double PI = acos(-1.0); const double EPS = 1e-10; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;}; template vector smallest_prime_factors(T n) { vector spf(n + 1); for (int i = 0; i <= n; i++) spf[i] = i; for (T i = 2; i * i <= n; i++) { // 素数だったら if (spf[i] == i) { for (T j = i * i; j <= n; j += i) { // iを持つ整数かつまだ素数が決まっていないなら if (spf[j] == j) { spf[j] = i; } } } } return spf; } template map factorization(T x, vector &spf) { map ret; while (x != 1) { ret[spf[x]]++; x /= spf[x]; } //sort(ret.begin(), ret.end()); return ret; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int X; cin >> X; auto spf = smallest_prime_factors(X); vector> ans; int ma = INF; for(int i=X;i>=0;i--){ int d1 = 1, d2 = 1; if(i > 1){ auto res1 = factorization(i, spf); for(auto x : res1) d1 *= (x.second + 1); } if(X-i > 1){ auto res2 = factorization(X-i, spf); for(auto x : res2) d2 *= (x.second + 1); } int f = abs((i - d1) - (X-i - d2)); if(f == ma){ ans.emplace_back(i, X-i); //ans.emplace_back(X-i, i); } else if(f < ma){ ma = f; ans = vector> (); ans.emplace_back(i, X-i); //ans.emplace_back(X-i, i); } } //cout << ma << endl; sort(ans.begin(), ans.end()); for(auto x : ans) cout << x.first << " " << x.second << endl; }