#include <bits/stdc++.h>
using namespace std;
int arr[1000000];
void markMultiples(int a, int n) {
  int i = 2, num;
  while ((num = i * a) <= n) {
    arr[num - 1] = 1;
    ++i;
  }
}
void SieveOfEratosthenes(int n) {
  if (n >= 2) {
    for (int i = 1; i < n; ++i)
      if (arr[i] == 0) markMultiples(i + 1, n);
  }
}
int main() {
  int n;
  cin >> n;
  SieveOfEratosthenes(n);
  for (int i = 1; i < n; i++) {
    if (arr[i] == 1 && arr[n - i - 2] == 1) {
      cout << i + 1 << " " << n - i - 1;
      cout << "\n";
      break;
    }
  }
  return 0;
}
