#pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include using namespace std; template bool chmin(T& a, const T& b){ if(a > b){ a = b; return 1; } return 0; } using uint = unsigned; int f(uint N){ uint d=0,sq=sqrt(N); for(uint i=2;i<=sq;i++){ if(N%i==0){ if(N/i==i)d++; else d+=2; } } return N-d; } int main() { uint X; scanf("%u", &X); uint mid = X / 2; constexpr uint width = 119; uint mindif = X; vector ans; ans.reserve(8); for(uint A = mid; A && A + width > mid; A--){ uint a = abs(f(A) - f(X - A)); if(chmin(mindif, a)) ans.clear(); if(mindif == a) ans.push_back(A); } for(uint i = ans.size(); i--; ) printf("%u %u\n", ans[i], X - ans[i]); for(uint i = mid * 2 == X; i < ans.size(); i++) printf("%u %u\n", X - ans[i], ans[i]); }