#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){ map m; int a = n, s = 1; for(int j = 2; j <= pow(n, 0.5); ++j){ int b = 0; while(a % j == 0){ a /= j; ++b; } if(b != 0) m[j] = b; if(a == 1) break; } if(a != 1 && !m.count(a)) m[a] = 1; for(auto c: m){ s *= c.se; } return n-s; } int main() { int x, m; cin >> x; vector v; rep(i, x/2) v.push_back(make_pair(abs(f(i+1) == f(x-i-1)), i+1)); sort(v.begin(), v.end()); m = v[0].fi; rep(i, x/2) if(v[i].fi == m) cout << v[i].se << " " << x-v[i].se << endl; return 0; }