#include using namespace std; template std::vector get_min_prime_fact_table(INT n){ std::vector lp(n + 1), P; for (INT i = 2; i <= n; i++){ if (lp[i] == 0){ lp[i] = i; P.push_back(i); } for (INT j = 0; j <= P.size() and P[j] <= lp[i] and i * P[j] <= n; j++) lp[i * P[j]] = P[j]; } return lp; } template std::map prime_factorize(INT n, std::vector lp){ std::map res; while (n != 1){ res[lp[n]]++; n /= lp[n]; } return res; } int main(){ int x; cin >> x; auto lp = get_min_prime_fact_table(x); vector A(x + 1); int ma = 1e9; for (int a = 1; a < x; a++){ auto b = x - a; auto pa = prime_factorize(a, lp); auto pb = prime_factorize(b, lp); int ca = 1, cb = 1; for (const auto &[k, v] : pa) ca *= (v + 1); for (const auto &[k, v] : pb) cb *= (v + 1); auto s = abs(a - ca - (b - cb)); A[a] = s; ma = min(ma, s); } for (int i = 1; i < x; i++){ if (A[i] == ma){ cout << i << " " << x - i << endl; } } }