#include <iostream>
using namespace std;

int main() {

  bool sosu[60000] = {false};

  for ( int i = 2; i < 60000; i++ ) {

    if ( sosu[i] == false ) {
      for ( int j = i*2; j < 60000; j+=i ) {
	sosu[j] = true;
      }
    }

  }

  int n;

  while( cin >> n ) {
    int cnt = n-1;
    while(true) {
      if ( sosu[cnt] == false ) {
	break;
      }
      cnt--;
    }
    n++;
    while(true) {
      if ( sosu[n] == false ) {
	cout << cnt << " " << n << endl;
	break;
      }
      n++;
    }
  }

  return 0;

}