X = int(eval(input()))



ans = 0

for i in range(1,1001):

    for j in range(2,11):

        tmp = i ** j

        if tmp <= X:

            ans = max(ans, i ** j)



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



ans = 1

for i in range(2,int(X**.5)+1):

    j = 2

    while i ** j <= X:

        ans = max(ans, i ** j)

        j += 1



print(ans)
X = int(eval(input()))
ans = 0
for i in range(1, 1001):
    for j in range(2, 11):
        tmp = i**j
        if tmp <= X:
            ans = max(ans, i**j)
print(ans)

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

-ans = 0 -for i in range(1, 1001): -    for j in range(2, 11): -        tmp = i**j -        if tmp <= X: -            ans = max(ans, i**j) +ans = 1 +for i in range(2, int(X**0.5) + 1): +    j = 2 +    while i**j <= X: +        ans = max(ans, i**j) +        j += 1