#include<stdio.h>
int main(void)
{
	int n,i;
	while(1){
	scanf("%d",&n);
	if(n==0) break;
		for(i=n;i>0;i--){
			if(i==5||i==7){
				printf("%d %d\n",i-2,i);
				break;
			}
			else if(i%2!=0&&i%3!=0&&i%5!=0&&i%7!=0){
				if((i-2)%2!=0&&(i-2)%3!=0&&(i-2)%5!=0&&(i-2)%7!=0){
					printf("%d %d\n",i-2,i);
					break;
				}
			}
		}
	}
	return 0;
}