#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n) - 1; i >= 0; i--) #define range(a) a.begin(), a.end() int main() { int X; cin >> X; vector cnt(X + 1); for (int i = 1; i <= X; i++) { for (int j = i; j <= X; j += i) { cnt[j]++; } } auto f = [&](int x) { return x - cnt[x]; }; int ans = INT_MAX; vector> pairs; for (int i = 1; i <= X - 1; i++) { int j = X - i; int cost = abs(f(i) - f(j)); if (ans > cost) { ans = cost; pairs.clear(); pairs.emplace_back(i, j); } else if (ans == cost) { pairs.emplace_back(i, j); } } for (auto p : pairs) { cout << p.first << ' ' << p.second << '\n'; } }