#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; const ll MOD = 1000000007; const ll INF = 2147483647; const ll LINF = 9223372036854775807; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() const int MAX = 2000001; VI d(MAX,0); VI p(0); void yaku(int n, int nk, int yk, ll x){ if(x >= MAX){ return; } d[x] = yk; for(int i = n;i < p.size();i++){ if(nk == 0){ yaku(i,1,2,p[i]); } else if(i == n){ yaku(i,nk+1,yk+(yk/(nk+1)),x*p[i]); } else{ yaku(i,1,yk*2,x*p[i]); } } } int main() { int x; cin >> x; VI f(MAX,1); p.push_back(2); int pr = 2; while(1){ for(int i = 2;i * pr < MAX;i++){ f[i*pr] = 0; } bool no = 1; for(int i = pr+1;i < MAX;i++){ if(f[i]){ pr = i; no = 0; break; } } if(no){ break; } p.push_back(pr); } yaku(0,0,0,1); int mina = INF; for(int i = 1;i <= x/2;i++){ mina = min(mina,(int)abs(i-d[i]-(x-i)+d[x-i])); } for(int i = 1;i < x;i++){ if(abs(i-d[i]-(x-i)+d[x-i]) == mina){ cout << i << ' ' << x-i << endl; } } return 0; }