import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int pre = 0;
        int rear = 0;
        outer:
        for(int i = n/2; i>=2; i--){
            for(int j = 2; j<i; j++){
                if(i%j==0){
                    continue outer;
                }
            }
            pre = i;
            rear = n-pre;
            for(int k = 2; k<rear; k++){
                if(rear%k==0){
                    continue outer;
                }
            }
            break;
        }
        System.out.println(pre);
        System.out.println(rear);
    }
}