while(line = readline()) {
let num = parseInt(line);
let diff = 9999999999;
for(let start=1; start <= num/2; start++) {
for (let end=Math.floor(num/2); end < num; end++) {
if (start + end == num && isZhi(end) && isZhi(start)) {
if (end - start < diff ) {
diff = end - start;
}
}
}
}
let x = (diff + num) / 2;
let y = (num - diff) / 2;
print(y+'\n'+x)
function isZhi(count) {
let status = true;
for (let i=2; i<=count/2; i++) {
if (count%i == 0) {
status = false;
}
}
return status;
}
}