#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<int ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

vector<int> prime;
vector<int> ls;

void sieve(int N){
    prime.resize(N+1,1);
    prime[0] = prime[1] = 0;
    for(int i=2;i*i<=N;i++){
        for(int j=i*i;j<=N;j+=i){
            prime[j] = 0;
        }
    }
    for(int i=2;i<=N;i++){
        if(prime[i])ls.push_back(i);
    }
}

int main() {
    sieve(int(1e5));
    int n;
    while(cin >> n){
        int a, b;
        a = *--lower_bound(ALL(ls),n);
        b = *upper_bound(ALL(ls),n);
        cout << a << " " << b << endl;
    }
    return 0;
}
