#include<iostream>
#include<math.h>
using namespace std;
int prim( int n)
{
if(n==2)
return 1;
if(n==1 || n%2==0)
return 0;
for(int m=3;m*m<=n;m=m+2)
if(n%m==0)
return 0;
return 1;}i
nt main()
{ float x,p,q;
cin>>x;
if(floor(x)==x)
{ p=x-1; q=x+1; }
else
{
p=floor(x);
q=floor(x)+1;
}
while(!prim(p))
p--;
while(!prim(q))
q++;
cout<<p<<" "<<q;
return 0;
}