#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = false;
//---------------------------------//

int main() {
	int X;
	cin >> X;
	vector<int> f(X + 1);
	iota(ALL(f), 0);
	FOR(i, 1, X + 1) for (int j = i; j <= X; j += i) --f[j];
	
	int mn = INF;
	vector<int> ans;
	FOR(i, 1, X) {
		const int cur = abs(f[i] - f[X - i]);
		if (mn < cur) continue;
		if (chmin(mn, cur)) ans.clear();
		ans.emplace_back(i);
	}
	for (int i : ans) printf("%d %d\n", i, X - i);
}