x = int(eval(input()))

r = 1



for b in range(1, int(x**0.5 + 1)):

    for p in range(2, 11):

        if b**p > x:

            break

        r = max(r, b**p)

        

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

cnt = []

for b in range(1, int(x**0.5)+1):

    for p in range(2, 11):

        if b**p <= x:

            cnt.append(b**p)

            

print((max(cnt)))
x = int(eval(input()))
r = 1
for b in range(1, int(x**0.5 + 1)):
    for p in range(2, 11):
        if b**p > x:
            break
        r = max(r, b**p)
print(r)

x = int(eval(input()))
cnt = []
for b in range(1, int(x**0.5) + 1):
    for p in range(2, 11):
        if b**p <= x:
            cnt.append(b**p)
print((max(cnt)))

-r = 1 -for b in range(1, int(x**0.5 + 1)): +cnt = [] +for b in range(1, int(x**0.5) + 1): -        if b**p > x: -            break -        r = max(r, b**p) -print(r) +        if b**p <= x: +            cnt.append(b**p) +print((max(cnt)))