#include <bits/stdc++.h>
using namespace std;
int prime[1000006];
void seive() {
  for (int i = 2; i <= sqrt(1000000); i++) {
    if (prime[i] == 0) {
      for (int j = i * i; j <= 1000000; j = j + i) prime[j] = 1;
    }
  }
}
int main() {
  int n;
  cin >> n;
  seive();
  int j = n - 1;
  for (int i = 1; i <= n / 2 && i <= j; i++) {
    if (prime[i] == 1 && prime[j] == 1) {
      cout << i << " " << j << endl;
      return 0;
    }
    j--;
  }
  return 0;
}
