def judge(x):

    for i in range(2, x):

        t = x

        while t != 1:

            if t % i == 0:

                t //= i

            else:

                break

            if t == 1:

                return True

    return False





x = int(eval(input()))



ans = 1



for i in range(x, 1, -1):

    if judge(i):

        ans = i

        break



print(ans)

x = int(eval(input()))

ans = 1

for base in range(1, 101):

    for p in range(2, 10):

        if base**p > x:

            break

        ans = max(ans, base**p)



print(ans)
def judge(x):
    for i in range(2, x):
        t = x
        while t != 1:
            if t % i == 0:
                t //= i
            else:
                break
            if t == 1:
                return True
    return False


x = int(eval(input()))
ans = 1
for i in range(x, 1, -1):
    if judge(i):
        ans = i
        break
print(ans)

x = int(eval(input()))
ans = 1
for base in range(1, 101):
    for p in range(2, 10):
        if base**p > x:
            break
        ans = max(ans, base**p)
print(ans)

-def judge(x): -    for i in range(2, x): -        t = x -        while t != 1: -            if t % i == 0: -                t //= i -            else: -                break -            if t == 1: -                return True -    return False - - -for i in range(x, 1, -1): -    if judge(i): -        ans = i -        break +for base in range(1, 101): +    for p in range(2, 10): +        if base**p > x: +            break +        ans = max(ans, base**p)