a = int(eval(input()))

l = [] 



for i in range(100):

    for j in range(2,10):

        if i**j <= a:

            l.append(i**j)

print((max(l)))
a = int(eval(input()))

m = 1

for i in range(a//2+1):

    for j in range(1,10):

        if a>=i**j and m <i**j:

            m = i**j

        if a < i**j:

            break

print(m)

a = int(eval(input()))
l = []
for i in range(100):
    for j in range(2, 10):
        if i**j <= a:
            l.append(i**j)
print((max(l)))

a = int(eval(input()))
m = 1
for i in range(a // 2 + 1):
    for j in range(1, 10):
        if a >= i**j and m < i**j:
            m = i**j
        if a < i**j:
            break
print(m)

-l = [] -for i in range(100): -    for j in range(2, 10): -        if i**j <= a: -            l.append(i**j) -print((max(l))) +m = 1 +for i in range(a // 2 + 1): +    for j in range(1, 10): +        if a >= i**j and m < i**j: +            m = i**j +        if a < i**j: +            break +print(m)