x = int(eval(input()))



ans = 0

for i in range(1, 1000):

    for j in range(2, 10):

        if i ** j <= x:

            ans = max(i ** j, ans)

            

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



ans = 0

if x == 1:

    ans = 1

else:

    for i in range(2, 100):

        n = 2

        while i ** n <= x:

            ans = max(ans , i ** n)

            n += 1

            

print(ans)
x = int(eval(input()))
ans = 0
for i in range(1, 1000):
    for j in range(2, 10):
        if i**j <= x:
            ans = max(i**j, ans)
print(ans)

x = int(eval(input()))
ans = 0
if x == 1:
    ans = 1
else:
    for i in range(2, 100):
        n = 2
        while i**n <= x:
            ans = max(ans, i**n)
            n += 1
print(ans)

-for i in range(1, 1000): -    for j in range(2, 10): -        if i**j <= x: -            ans = max(i**j, ans) +if x == 1: +    ans = 1 +else: +    for i in range(2, 100): +        n = 2 +        while i**n <= x: +            ans = max(ans, i**n) +            n += 1