#include #include using namespace std; bool have7(const int n) noexcept { int r = n; for (int i = 0; i < log10(n); ++i) { if (r % 10 == 7) { return true; } r = floor(r / 10); } return false; } int main() { int n, a, b; cin >> n; for (int i = 1; i < n; ++i) { if (have7(i)) { continue; } if (have7(n-i)) { continue; } a = i; b = n - i; break; } cout << a << " " << b << endl; }