#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <sstream>
 
using namespace std;
 
int main(){
    int n;
    int nums[6000] = {0};
    
    int qf = 0;
    int qe = 0;
    for(int i = 2; i <= 50100; i++){
        bool f = false;
        for(int qe = 0; qe < qf; qe++ ){
            if(i < nums[qe] * nums[qe]) break; //この行で速さが変わる（爆速）
            if(i % nums[qe] == 0) {
                f = true;
                break;
            }
        }
        if(!f) { nums[qf] = i; qf++; }
    }

    while(cin >> n){
        int index = 0;
        while(true){
            if(nums[index + 1] == n) {
                cout << nums[index] << " " << nums[index + 2] << endl;
                break;
            }
            if(nums[index] <= n && nums[index + 1] >= n) {
                cout << nums[index] << " " << nums[index + 1] << endl;
                break;
            }
            index++;
        }
    }
    return 0;
}