X= int(eval(input()))



while True:

    pf={}

    m=X

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

        while m%i==0:

            pf[i]=pf.get(i,0)+1

            m//=i

    if m>1:pf[m]=1

    #print(pf)



    if (len(pf)==1) and (list(pf.values())[0]==1):

        break

    else:

        X +=1

        

print(m)


X = int(eval(input()))



while True:

    pf={}

    m=X

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

        while m%i==0:

            pf[i]=pf.get(i,0)+1

            m//=i

    if m>1:pf[m]=1

    #print(i,pf)

    #print(len(list(pf)))



    if len(list(pf))==1 and list(pf.values())[0]==1:

        break

    else:

        X+=1



print(m)

X = int(eval(input()))
while True:
    pf = {}
    m = X
    for i in range(2, int(m**0.5) + 1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1:
        pf[m] = 1
    # print(pf)
    if (len(pf) == 1) and (list(pf.values())[0] == 1):
        break
    else:
        X += 1
print(m)

X = int(eval(input()))
while True:
    pf = {}
    m = X
    for i in range(2, int(m**0.5) + 1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1:
        pf[m] = 1
    # print(i,pf)
    # print(len(list(pf)))
    if len(list(pf)) == 1 and list(pf.values())[0] == 1:
        break
    else:
        X += 1
print(m)

-    # print(pf) -    if (len(pf) == 1) and (list(pf.values())[0] == 1): +    # print(i,pf) +    # print(len(list(pf))) +    if len(list(pf)) == 1 and list(pf.values())[0] == 1: