#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int math[100000]={0};
  math[1]=1;
  for(int i=2;i<100000;i++){
    int bell=i;
    while(bell+i<=100000){
      bell+=i;
      if(math[bell]==0){
	math[bell]=1;
      }
    }
  }

  int hess=n;
  while(1){
    hess--;
    if(math[hess]==0){
      cout << hess << " ";
      break;
    }
  }

  hess=n;
  while(1){
    hess++;
    if(math[hess]==0){
      cout << hess << endl;
      break;
    }
  }

  return (0);
}