r, i = range, input


def p(n):
    for i in r(2, int(n ** 0.5) + 1):
        if n % 1 == 0:
            return 0
    return 1


for _ in r(i()):
    n = i()
    while 1:
        n += 1
        if p(n):
            print(n)
            break

d4b476d5bf9741e6cd25e61dd0ad306caee8f1c0
<mask token>

<mask token>


def p(n):
    for i in r(2, int(n ** 0.5) + 1):
        if n % 1 == 0:
            return 0
    return 1


<mask token>

<mask token>


def p(n):
    for i in r(2, int(n ** 0.5) + 1):
        if n % 1 == 0:
            return 0
    return 1


for _ in r(i()):
    n = i()
    while 1:
        n += 1
        if p(n):
            print(n)
            break

r, i = range, input


def p(n):
    for i in r(2, int(n ** 0.5) + 1):
        if n % 1 == 0:
            return 0
    return 1


for _ in r(i()):
    n = i()
    while 1:
        n += 1
        if p(n):
            print(n)
            break
