MAX = 60000
lst = [i for i in range(MAX)]
lst[0] = lst[1] = 0
for i in range(MAX):
  if lst[i] != 0:
    for j in range(i * 2, MAX, i):
      lst[j] = 0
while 0 == 0:
  try:
    n = int(input())
    i = n - 1
    j = n + 1
    while lst[i] == 0:
      i -= 1
    while lst[j] == 0:
      j += 1
    print(lst[i],lst[j])
  except EOFError:
    break
