#include <bits/stdc++.h>
using namespace std;
const int NUM_PRIMES = 1000005;
bool primes[NUM_PRIMES];
void populatePrimes() {
  fill(primes, primes + NUM_PRIMES, true);
  primes[1] = false;
  for (int i = 4; i < NUM_PRIMES; i += 2) {
    primes[i] = false;
  }
  int l = sqrt(NUM_PRIMES);
  for (int i = 3; i < l; i += 2) {
    int x = i + i;
    while (x < NUM_PRIMES) {
      primes[x] = false;
      x += i;
    }
  }
}
int main() {
  int n;
  cin >> n;
  populatePrimes();
  int m = n / 2;
  for (int i = 0; i < m; i++) {
    int a = i + m + (n % 2);
    int b = m - i;
    if (!primes[a] && !primes[b]) {
      cout << a << " " << b << endl;
      break;
    }
  }
  return 0;
}
