x =int(eval(input()))

for n in range(x, 0, -1):

    for b in range(1, n + 1):

        for p in range(2, n + 1):

            if b ** p == n:

                print(n)

                exit()

            elif b ** p > n:

                break

print((1))

X = int(eval(input()))

ans = 1



for i in range(2, X + 1):

    j = 2

    while i ** j <= X:

        ans = max(ans, i ** j)

        j += 1



print(ans)
x = int(eval(input()))
for n in range(x, 0, -1):
    for b in range(1, n + 1):
        for p in range(2, n + 1):
            if b**p == n:
                print(n)
                exit()
            elif b**p > n:
                break
print((1))

X = int(eval(input()))
ans = 1
for i in range(2, X + 1):
    j = 2
    while i**j <= X:
        ans = max(ans, i**j)
        j += 1
print(ans)

-x = int(eval(input())) -for n in range(x, 0, -1): -    for b in range(1, n + 1): -        for p in range(2, n + 1): -            if b**p == n: -                print(n) -                exit() -            elif b**p > n: -                break -print((1)) +X = int(eval(input())) +ans = 1 +for i in range(2, X + 1): +    j = 2 +    while i**j <= X: +        ans = max(ans, i**j) +        j += 1 +print(ans)