#include #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define repr(i,n) for(int i = (int)(n-1); i >= 0; i--) #define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++) #define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++) #define repitr(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++) #define ALL(n) begin(n), end(n) using ll = long long; using namespace std; int fanc(int x){ int ans = 0; if(x == 1){ return 1; } for(int i = 1; i * i <= x; i++){ if(i*i == x) ans++; else if(x % i == 0)ans += 2; } //cerr << x << " " << ans <> x; vector> vp(x-1); rep2(i, 1, x){ int j = x - i; int di = fanc(i), dj = fanc(j); int temp = fabs((i - di) - (j - dj)); mn = min(mn, temp); vp.at(i-1) = make_pair(i, temp); } //cerr << "mn:" << mn << endl; for(auto p : vp){ if(p.second == mn){ cout << p.first << " " << x - p.first << endl; } } return 0; }