#include<stdio.h>
#include<math.h>

int	Prime(int	x){
	int	n;
	if(x	==	2)return	1;
	if(x	<	2	||	x	%	2	==	0)return	0;
	for(n	=	3;	n	<=	sqrt((double)x);	n	+=	2){
		if(x	%	n	==	0)return	0;
	}
	return	1;
}

int	main(){
	int	n,	i,	cnt	=	0,	max	=	0,	data[10000];
	scanf("%d",	&n);
	for(i	=	0;	i	<=	n;	i++){
		if(Prime(i)	==	1){
			data[cnt]	=	i;
//			if(data[cnt]	-	data[cnt	-	1]	==	2)max	=	cnt;
			cnt++;
		}	
	}
	for(i	=	1;	i	<=	cnt;	i++){
		if(data[i]	-	data[i	-	1]	==	2)max	=	i;
	}
	
		
	if(max	!=	0)printf("%d %d\n",	data[max - 1],	data[max]);
	return	0;
}