#include <stdio.h>
#include <math.h>

#define NUM 1000000

int main(void)
{
  unsigned i, j;
  unsigned sq_num = (int)sqrt((double)NUM);
  unsigned prime[NUM];
  int n, x;

  scanf("%d",&n);

  for (i = 0; i < NUM; i++)
    prime[i] = 1;  
  prime[0] = 0;    

  for (i = 1; i < sq_num; i++) {
    if (prime[i] == 1)          
      for (j = (i+1); (i+1) * j <= NUM; j++)
        prime[(i+1) * j - 1] = 0;  
  }

  for (i = 0; i < NUM; i++){
  	if (prime[i] == 1 && i < n)
  		x = i;

    if (prime[i] == 1 && i > n){
      printf("%d %d\n", x, i + 1);
      break;
    }

}
  return 0;
}