#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; i < (int)p.size(); i++){
			if (in == p[i]){
				cout << p[i - 1] << " " << p[i+1] << endl;
				break;
			}else if (in < p[i]){
				cout << p[i - 1] << " " << p[i] << endl;
			}
		}
	}


}