#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    bool is_prime[1000000];

    is_prime[0] = is_prime[1] = false;

    for(int i=2; i<1000000; i++){
        is_prime[i] = true;
    }

    for(int i=2; i*i<1000000; i++){
        if(is_prime[i]){
            for(int j=i*i; j<1000000; j+=i){
                is_prime[j] = false;
            }
        }
    }

    while(true){
        int n;
        cin >> n;
        if(cin.eof()){
            break;
        }
        int mn,mx;
        for(int i=2; i<=100000; i++){
            if(is_prime[i]){
                if(i < n){
                    mn = i;
                }else{
                    if(i != n){
                        mx = i;
                        break;
                    }
                }
            }
        }
        cout << mn << " " << mx << endl;
    }
    return 0;
}
