#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main(void)
{
	int n, min=2, max =2;

	while (cin >> n)
	{
		bool f;
		for (int i = n-1; i >= 2; i--)
		{
			if (i == 2)
			{
				max = 2;
				continue;
			}
			f = true;
			for (int j = i-1; j >= 2; j--)
			{
				if (i % j == 0)
				{
					f = false;
					break;
				}
			}
			if (f == true)
			{
				max = i;
				break;
			}
		}
		for (int i = n + 1;; i++)
		{
			f = true;
			for (int j = i-1; j >= 2; j--)
			{
				if (i % j == 0)
				{
					f = false;
					break;
				}
			}
			if (f == true)
			{
				min = i;
				break;
			}
		}
		cout << max << " " << min << endl;
	}
	return 0;
}
