n=int(eval(input()))



ans = 1



i = 2



while i**2 <= n:

    u = 2

    while i**u <= n:

        ans = max(i**u, ans)

        u += 1

    i += 1

print(ans)
N = int(eval(input()))



ans = 1

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

    tmp = 2

    while i**tmp<=N:

        ans = max(ans,i**tmp)

        tmp += 1

print(ans)
n = int(eval(input()))
ans = 1
i = 2
while i**2 <= n:
    u = 2
    while i**u <= n:
        ans = max(i**u, ans)
        u += 1
    i += 1
print(ans)

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

-n = int(eval(input())) +N = int(eval(input())) -i = 2 -while i**2 <= n: -    u = 2 -    while i**u <= n: -        ans = max(i**u, ans) -        u += 1 -    i += 1 +for i in range(2, N + 1): +    tmp = 2 +    while i**tmp <= N: +        ans = max(ans, i**tmp) +        tmp += 1