#include<stdio.h>
const int MAX_V = 10000;
int prime[MAX_V];
int main(){
	int i, k, n =10, cnt = 0;
	int border[10];
	for( i = 2; i <= MAX_V; i++) {
		prime[i] = 1;
	}
	for(i = 2; i*i <= MAX_V; i++){
		if(prime[i]) {
			for(k = 2 * i; k <= MAX_V; k += i){
				prime[k] = 0;
			}
		}
	}
	int difference[MAX_V+1];
	int idx = 2;
	for( i = 2; i < MAX_V; i++){
		if(prime[i] == 1){
			difference[i] = i - idx;
			idx = i;
		}
	}
	
	for( i = 0; i < n; i++){
		scanf("%d", &border[i]);
		if(border[i] == 0) break;
		cnt++;
	}
	
	int max[10] = {0};
	for( i = 0; i < cnt; i++){
		for( k = 2; k <= border[i]; k++){
			if( difference[k] == 2 && k > max[i]){
				max[i] = k;
			}
		}
		printf("%d %d\n", max[i] - 2, max[i]);
	}
	return 0;
}