#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
using namespace std;



int main(){
	int d,arr[100000],count,ch;
	arr[0]=2;
	count =0;
	for(int i=3;i<=50100;i++){
		ch=0;
		for(int j=0;j<=count;j++){
			if(i%arr[j] == 0)ch=1;
		}
		if(ch == 0){
			count++;
			arr[count]=i;
		}
	}
	while(scanf("%d",&d) != EOF){
		for(int i=0;;i++){
			if(arr[i]==d){
				printf("%d %d\n",arr[i-1],arr[i+1]);
				break;
			}
			if(arr[i]>d){
				printf("%d %d\n",arr[i-1],arr[i]);
				break;
			}
		}
	}
		
	
	return 0;
}
