#include <bits/stdc++.h>
using namespace std;
bool composite(int n) {
  int max = sqrt(n);
  if (n % 2 == 0) return true;
  for (int i = 3; i <= max; i += 2)
    if (n % i == 0) return true;
  return false;
}
pair<int, int> solve(int n) {
  if (n % 2 == 0) return {4, n - 4};
  if (n % 3 == 0) return {6, n - 6};
  for (int i = 3; i < n; i++) {
    if (composite(i) && composite(n - i)) return {i, n - i};
  }
  return {0, 0};
}
int main() {
  int n;
  cin >> n;
  pair<int, int> answer = solve(n);
  cout << answer.first << " " << answer.second;
}
