#include <iostream>
#include <cstring>
#include <cmath>
#include <ostream>
#include <vector>
using namespace std;
    int n,m,k,i,t=1;
    int prm(int k)
    {
       for(i=2;i<=sqrt(k);i++){
       if(k%i==0)
       return 0;
       }
       return 1;
    }
    int main(){
    cin >> m;
    if (m==5){
    cout << 3 <<" " << 5 << std::endl;}
    else
    {
    for (m>5;m<=10000;m--)
    {
    if ((m%10==1||m%10==3||m%10==7||m%10==9)&&(m%6==1)&&prm(m)&&prm(m-2))
    break;
    }
    
    cout << m-2 <<" " << m << std::endl;
    }
}
