#include using namespace std; int D[2000001]; int N; int f(int k) { return k - D[k]; } int main() { cin >> N; for (int i = 1; i <= N; ++i) { for (int k = i; k <= N; k += i) { ++D[k]; } } map> mp; for (int i = 1; i < N; ++i) { int a = i; int b = N - i; int diff = abs(f(a) - f(b)); mp[diff].push_back(a); } for (int a : mp.begin()->second) { cout << a << ' ' << N - a << endl; } }