#include <iostream>
#include <cmath>
using namespace std;
bool is_sunumber(int n);
void find_two(int n);
int main() {
int num;
cin >> num;
find_two(num);
}
bool is_sunumber(int num){//判断一个数是不是素数
if (num <= 1) return false;
if (num == 2) return true;
if (num % 2 == 0) return false;
for (int i = 3; i <= std::sqrt(num); i += 2) {
if (num % i == 0) return false;
}
return true;
}
void find_two(int n){//找最小的素数对并输出
int num1,num2;
int min_diff=n;
for(int i=2 ; i<=n/2 ; i++){
int j = n - i;
if(is_sunumber(i) && is_sunumber(j)){
int diff = std::abs(i-j);
if(min_diff > diff){
min_diff = diff;
num1 = i;
num2 = j;
}
}
}
cout << num1 << endl;
cout << num2 << endl;
}