#include<iostream>
#include<vector>

using namespace std;



int main(){
	int in;
	int prime[50001] = {};

	vector<int> p;
	int i, j;
	for (i = 2; i*i < 50000; i++){
		if (prime[i] == 0){
			for (j = 2; i*j <= 50000; j++){
				prime[i*j] = 1;
			}
		}
	}
	for (i = 1; i < 50001; i++){
		if (prime[i] == 0){
			p.push_back(i);
		}
	}



	while (cin >> in){
		for (i = 1; in >= p[i]; i++);
		if (p[i - 1] == in){
			cout << p[i - 2] << " " << p[i] << endl;
		}
		else{
			cout << p[i - 1] << " " << p[i] << endl;
			break;
		}
	}
}