#include <iostream>
#include <cstring>

using namespace std;

int main(void){
  int prime[50000];
  int prime_f[50001];
  int k;
  int n;
  int i,j;
  int n_size;
  bool once;

  while(cin>>n){
    once=true;
    k=0;
    memset(prime_f,0,sizeof(prime_f));
    prime_f[0]=prime_f[1]=1;
    for(i=2;i<50000;i++){
      if(!prime_f[i]){
	k++;
	prime[k]=i;
	if(prime[k]>n&&once){
	  n_size=k-1;
	  once=false;
	}
	for(j=2*i;j<50000;j+=i){
	  prime_f[j]=1;
	}
      }
    }
    cout<<prime[n_size-1]<<" "<<prime[n_size+1]<<endl;
  }  
  return(0);
}