#include <bits/stdc++.h>
int f(int n) {
  long long int i;
  for (i = 2; i <= n / 2; i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
int main() {
  long long int a, b, c, i, k, j, n;
  scanf("%lld", &n);
  if (n % 2 == 0) {
    a = f(n / 2);
    if (a == 0) printf("%lld %lld\n", n / 2, n / 2);
    if (a == 1) {
      b = n / 2;
      c = n / 2;
      for (i = 1;; i++) {
        b++;
        c--;
        j = f(b);
        k = f(c);
        if (j == 0 && k == 0) {
          printf("%lld %lld\n", b, c);
          break;
        }
      }
    }
  }
  if (n % 2 != 0) {
    a = f(n - 4);
    if (a == 0) printf("%lld 4\n", n - 4);
    if (a == 1) {
      b = 4;
      c = n - 4;
      for (i = 1;; i++) {
        b += 2;
        c -= 2;
        j = f(b);
        k = f(c);
        if (j == 0 && k == 0) {
          printf("%lld %lld\n", b, c);
          break;
        }
      }
    }
  }
}
