x = int(eval(input()))

bp = 0

for i in range(x):

    for j in range(9):

        if((i+1)**(j+2)<=x):

            bp = max(bp,(i+1)**(j+2))

print(bp)

import math



x=int(eval(input()))

a=int(math.sqrt(x)//1)

ans=1

for i in range(1,a+1):

    for j in range(2,a+1):

        if i**j<=x:

            ans=max(ans,i**j)

print(ans)

x = int(eval(input()))
bp = 0
for i in range(x):
    for j in range(9):
        if (i + 1) ** (j + 2) <= x:
            bp = max(bp, (i + 1) ** (j + 2))
print(bp)

import math

x = int(eval(input()))
a = int(math.sqrt(x) // 1)
ans = 1
for i in range(1, a + 1):
    for j in range(2, a + 1):
        if i**j <= x:
            ans = max(ans, i**j)
print(ans)

+import math + -bp = 0 -for i in range(x): -    for j in range(9): -        if (i + 1) ** (j + 2) <= x: -            bp = max(bp, (i + 1) ** (j + 2)) -print(bp) +a = int(math.sqrt(x) // 1) +ans = 1 +for i in range(1, a + 1): +    for j in range(2, a + 1): +        if i**j <= x: +            ans = max(ans, i**j) +print(ans)