#include <stdio.h>
#define MAX 60000
int main(void){
 	int i,j;
	int a[MAX+1];
	int n;
	int bn,check;
	while(scanf("%d",&n) != EOF){
		  check = 0;
		  for(i = 1; i <= MAX; i++){
			  a[i] = 0;
		  }
		  for(i = 2; i <= MAX; i++){
			  if(a[i]){continue;}
			  for(j = i; j <= MAX; j += i){
				  if(j == i){a[i] = 0;}
				  else{a[j] = 1;}
			  }
		  }
		  for(i = 2; i <= MAX; i++){
			  if(!a[i]){
				 if(n == i){
					printf("%d ",bn);
					check = 1;
				 }else if(!check){
					bn = i;
				 }else{
					printf("%d\n",i);
					break;
				 }
			  }
		  }
	}
 	return 0;
}