#include <iostream>
#include <vector>
using namespace std;

int main(){
  constexpr int M = 10001;
  vector<bool> P(M,true);
  for(int i = 2; i*i < M; ++i){
    if(not P[i]) continue;
    for(int j = i; i*j < M; ++j){
      P[i*j] = false;
    }
  }
  vector<int> A(M,-1);
  for(int i = 5; i < M; ++i){
    if(not P[i]) A[i] = A[i-1];
    else if(P[i-2]) A[i] = i;
    else A[i] = A[i-1];
  }
  int n;
  while(cin >> n,n){
    cout << A[n]-2 << " " << A[n] << endl;
  }
}

