x = int(eval(input()))

while True:

    is_prime = True

    for i in range(2, x):

        if x % i == 0:

            is_prime = False

            break

    if is_prime:

        print(x)

        break

    x += 1

x = int(eval(input()))

def is_prime(x):

    if x <= 1:

        return False

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

        if x % i == 0:

            return False

    return True



while(not is_prime(x)):

    x += 1

print(x)

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

x = int(eval(input()))


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


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

-while True: -    is_prime = True -    for i in range(2, x): + + +def is_prime(x): +    if x <= 1: +        return False +    for i in range(2, int(x**0.5) + 1): -            is_prime = False -            break -    if is_prime: -        print(x) -        break +            return False +    return True + + +while not is_prime(x): +print(x)