import math

X = int(eval(input()))

max = 0

x = math.floor(math.sqrt(X))

for b in range(x + 1):

    for p in range(x + 1):

        # print(b**p)

        if(max < b**p <= X):

            max = b**p

print(max)

import math

X = int(eval(input()))

max = 0

bRange = math.floor(math.sqrt(X))

pRange = math.floor(math.log(X,2))

for b in range(bRange + 1):

    for p in range(pRange + 1):

        # print(b**p)

        if(max < b**p <= X):

            max = b**p

print(max)

import math

X = int(eval(input()))
max = 0
x = math.floor(math.sqrt(X))
for b in range(x + 1):
    for p in range(x + 1):
        # print(b**p)
        if max < b**p <= X:
            max = b**p
print(max)

import math

X = int(eval(input()))
max = 0
bRange = math.floor(math.sqrt(X))
pRange = math.floor(math.log(X, 2))
for b in range(bRange + 1):
    for p in range(pRange + 1):
        # print(b**p)
        if max < b**p <= X:
            max = b**p
print(max)

-x = math.floor(math.sqrt(X)) -for b in range(x + 1): -    for p in range(x + 1): +bRange = math.floor(math.sqrt(X)) +pRange = math.floor(math.log(X, 2)) +for b in range(bRange + 1): +    for p in range(pRange + 1):