#include using namespace std; using ll = long long; using ld = long double; using vi = vector; using vvi = vector>; using vl = vector; using vvl = vector>; #define FOR(i, m, n) for (int i = (m); i < (n); i++) #define FORR(i, m, n) for (int i = (m); i >= (n); i--) #define REP(i, n) FOR(i, 0, (n)) #define REPR(i, n) FORR(i, (n) - 1, 0) #define REP1(i, n) FOR(i, 1, (n) + 1) #define REPS(c, s) for (char c : s) #define ALL(c) (c).begin(), (c).end() #define SORT(c) sort(ALL(c)) #define REV(c) reverse(ALL(c)) #define sz(v) (int)v.size() #define endl '\n' template inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;} template inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} template inline void printv(vector& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');} template inline void printlnv(vector& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;} const int MOD = 1000000007; const int INF = 1000000001; const ll LINF = 1000000001000000001LL; void solve(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(numeric_limits::max_digits10); solve(); return 0; } vector divisors(ll n) { vector v; for (ll i = 1; i * i <= n; i++) { if (n % i == 0) { v.push_back(i); if (i * i != n) { v.push_back(n / i); } } } return v; } void solve() { int n; cin >> n; vector> ans; int mn = INF; // auto v = divisors(n); // printv(v); auto f = [&](int x) {return x - sz(divisors(x));}; REP1(i, n / 2) { int d = abs(f(i) - f(n - i)); chmin(mn, d); ans.emplace_back(i, n - i, d); } for (auto t : ans) { if (get<2>(t) == mn) cout << get<0>(t) << " " << get<1>(t) << endl; } REV(ans); for (auto t : ans) { if (get<2>(t) == mn) cout << get<1>(t) << " " << get<0>(t) << endl; } }