#include<stdio.h>
int main(void){
  
  int i,j;
  int num[50001]={0,0,1};
  int sosu[5000]={2};
  int count=1;
  
  for(i=3;i<50001;i+=2){
    if(num[i]==1)
      continue;
    for(j=3*i;j<50001;j+=i*2)
      num[j]=1;
  }
  for(i=3;i<50001;i+=2){
    if(num[i]!=1){
      sosu[count]=i;
      count++;
    }
  }

  int in;
  while(scanf("%d",&in)!=EOF){
    for(i=0;i<50000;i++){
      if(in<sosu[i])
	break;
    }
    printf("%d %d",sosu[i-2],sosu[i]);
  }

  return 0;
}