#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
int d[2001000];

int main() {
    for(int i = 1; i <= 2e6; i++) {
        for(int j = i; j <= 2e6; j += i) {
            d[j]++;
        }
    }
    int X;
    cin >> X;
    vector<int> A;
    int val = 1e9;
    for(int i = 1; i < X; i++) {
        int now = abs(i - d[i] - (X - i) + d[X-i]);
        if(chmin(val, now)) {
            A.clear();
        }
        if(val == now) A.push_back(i);
    }
    for(auto tmp : A) {
        cout << tmp << " " << X - tmp << endl;
    }
    return 0;
}