#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iterator>
#include<vector>
using namespace std;
#define int long long
signed main(){
	vector<int> primes(50050,1);
	for(int i=2;i<230;i++){
		if(primes[i]==0) continue;
		for(int j=i+1;i<50050;i++){
			if(j%i==0) primes[j] = 0;
		}
	}
	int a;
	while( scanf("%lld", &a) != EOF ){
		for(int i=0;i<50050;i++){
			if(primes[i]>a){ cout << primes[i-1] << " " << primes[i] << endl; break;}
		}
	}
	return 0;
}