#include <iostream>
#include <vector>
using namespace std;
typedef vector <int> vi;
#define REP1(i,n1,n2) for (int i=n1; i<n2; i++)
vi primes;

int get_primes(int m){
    int n = (m+1)/2, root = (int)(pow(n, 0.5));
    vector <bool> N(n, true);
    N[0]=false;

    if (m>1) primes.push_back(2);
    REP1(i,1,root){
        int tmp = i*2+1;
        if (N[i]){
            primes.push_back(tmp);
            for (int j=i+tmp; j<n+1; j+=tmp)
				N[j]=false;
        }
    }
    REP1(i,root,n+1)
        if(N[i]) primes.push_back(2*i+1);
    return 0;
}

int main(){
	get_primes(50100);
	while (true){
		int n,a,b;
		cin>>n;
		if (cin.eof()) break;
		REP1(i,0,(int)primes.size()){
			a=primes[i];
			if (a<n) b=a;
			else if (a>n) break;
		}
		cout<<b<<" "<<a<<endl;
	}
}