#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #if __has_include() #include using namespace atcoder; #endif #define GET_MACRO(_1, _2, _3, NAME, ...) NAME #define _rep(i, n) _rep2(i, 0, n) #define _rep2(i, a, b) for(int i = (int)(a); i < (int)(b); i++) #define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using i64 = long long; template bool chmin(T& a, const U& b) { return (b < a) ? (a = b, true) : false; } template bool chmax(T& a, const U& b) { return (b > a) ? (a = b, true) : false; } templateistream& operator>>(istream&i,vector&v){rep(j,v.size())i>>v[j];return i;} templatestring join(vector&v){stringstream s;rep(i,v.size())s<<' '<ostream& operator<<(ostream&o,vector&v){if(v.size())o<string join(vector>&vv){string s="\n";rep(i,vv.size())s+=join(vv[i])+"\n";return s;} templateostream& operator<<(ostream&o,vector>&vv){if(vv.size())o< using pq = priority_queue, greater>; vector osa_k(int n) { vector res(n + 2); iota(res.begin(), res.end(), 0); for (int i = 4; i <= n; i += 2) res[i] = 2; for (int i = 9; i <= n; i += 6) res[i] = 3; for (int i = 6; i <= n; i += 6) { if (res[i - 1] == i - 1) { int w = (i - 1); if (n / w >= w) { for (int j = w * w; j <= n; j += 2 * w) { if (res[j] == j) res[j] = w; } } } if (res[i + 1] == i + 1) { int w = (i + 1); if (n / w >= w) { for (int j = w * w; j <= n; j += 2 * w) { if (res[j] == j) res[j] = w; } } } } return res; } int cnt(map mii) { int res = 1; for(auto [i, j] : mii) res *= (j + 1); return res; } int main() { int x; cin >> x; auto v = osa_k(x + 10); int min_ = (x + 10) * 2; vector> ans; rep(i, 1, x) { int j = i; int k = x - j; map mi, mj; while(v[j] != 1) { mi[v[j]] += 1; j /= v[j]; } while(v[k] != 1) { mj[v[k]] += 1; k /= v[k]; } int now = abs(i - cnt(mi) - (x - i - cnt(mj))); if(now == min_) { ans.emplace_back(i, x - i); }else if(now < min_) { min_ = now; ans.clear(); ans.emplace_back(i, x - i); } } for(auto [i, j] : ans) { cout << i << " " << j << endl; } return 0; }