X = int(eval(input()))



while True:

  flag = True

  for i in range(2, X):

    if X % i == 0:

      flag = False

  

  if flag: break

  X += 1

  

print(X)
X = int(eval(input()))

  

# 順に素数判定を行えばよい

def is_prime(x):

  if x <= 1:

    return False

  for i in range(2, x):

    if x % i == 0:

      return False

  return True

 

p = X

while not is_prime(p):

  p += 1

  

print(p)
X = int(eval(input()))
while True:
    flag = True
    for i in range(2, X):
        if X % i == 0:
            flag = False
    if flag:
        break
    X += 1
print(X)

X = int(eval(input()))
# 順に素数判定を行えばよい
def is_prime(x):
    if x <= 1:
        return False
    for i in range(2, x):
        if x % i == 0:
            return False
    return True


p = X
while not is_prime(p):
    p += 1
print(p)

-while True: -    flag = True -    for i in range(2, X): -        if X % i == 0: -            flag = False -    if flag: -        break -    X += 1 -print(X) +# 順に素数判定を行えばよい +def is_prime(x): +    if x <= 1: +        return False +    for i in range(2, x): +        if x % i == 0: +            return False +    return True + + +p = X +while not is_prime(p): +    p += 1 +print(p)