x=int(eval(input()))

def primeddx(x):

    for i in range(2,x):

        if x%i==0:

            return False

    return True



while not primeddx(x):

    x+=1

print(x)
x=int(eval(input()))

def primeddx(x):

    for i in range(2,int(x**0.5)):

        if x%i==0:

            return False

    return True



while not primeddx(x):

    x+=1

print(x)
x = int(eval(input()))


def primeddx(x):
    for i in range(2, x):
        if x % i == 0:
            return False
    return True


while not primeddx(x):
    x += 1
print(x)

x = int(eval(input()))


def primeddx(x):
    for i in range(2, int(x**0.5)):
        if x % i == 0:
            return False
    return True


while not primeddx(x):
    x += 1
print(x)

-    for i in range(2, x): +    for i in range(2, int(x**0.5)):