#include <bits/stdc++.h>  

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; -i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define PRIM 50021

bool prim[50022];
int a_prime[500022];

int main(){
	memset(prim, true, sizeof(prim));
	int N;
	prim[0] = false;
	FOR(i, 1, sqrt(PRIM)) {
		if(prim[i]) {
			for(int j = (i + 1); (i + 1) * j <= PRIM; ++j) {
				prim[(i + 1) * j - 1] = false;
			}
		}
	}
	int cnt = 0;
	rep(i, PRIM) {
		if(prim[i]) a_prime[cnt++] = i + 1;
	}
	while(scanf("%d", &N)) {
		rep(i, cnt) {
			if(a_prime[i + 1] >= N) {
				printf("%d ", a_prime[i]);
				break;
			}
		}
		rep(i, cnt) {
			if(a_prime[i] > N) {
				printf("%d\n", a_prime[i]);
				break;
			}
		}
	}
	return 0;
}