#include #define rep(i, n) for(int i = 0; i < n; ++i) #define rrep(i, n) for(int i = n-1; i >= 0; --i) #define fi first #define se second using namespace std; using lint = long long; using uint = unsigned int; using ulint = unsigned long long; using ldouble = long double; using pii = pair; using pli = pair; using pdd = pair; using pld = pair; using v1i = vector; using v1li = vector; using v2i = vector>; using v2li = vector>; using v3i = vector>>; using v3li = vector>>; using v1b = vector; using v2b = vector>; using v3b = vector>>; using v1c = vector; using v2c = vector>; using v3c = vector>>; constexpr lint mod1 = 1e9+7; int f(int n, v1i v){ map m; int a = n, s = 1; rep(i, v.size()){ if(v[i] > pow(n, 0.5)) break; int b = 0; while(a % v[i] == 0){ a /= v[i]; ++b; } if(b != 0) m[v[i]] = b; if(a == 1) break; } if(a != 1 && !m.count(a)) m[a] = 1; for(auto c: m){ s *= c.se+1; } return n-s; } int main() { v1i r = {2}; rep(i, 1e3*2){ if(i > 2){ bool b = 1; rep(j, r.size()){ if(r[j] > pow(i, 0.5)) break; else if(i % r[j] == 0){ b = 0; break; } } if(b) r.push_back(i); } } int x, m; cin >> x; vector v; if(x < 1000){ rep(i, x/2){ v.push_back(make_pair(abs(f(i+1, r) - f(x-i-1, r)), i+1)); if(i+1 != x-i-1) v.push_back(make_pair(abs(f(i+1, r) - f(x-i-1, r)), x-i-1)); } } else{ for(int i = x/2-500; i <= x/2; ++i){ v.push_back(make_pair(abs(f(i, r) - f(x-i, r)), i)); if(i != x-i) v.push_back(make_pair(abs(f(i, r) - f(x-i, r)), x-i)); } } sort(v.begin(), v.end()); m = v[0].fi; rep(i, v.size()) if(v[i].fi == m) cout << v[i].se << " " << x-v[i].se << endl; return 0; }