x=int(eval(input()))

ans=1

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

    for j in range(2,50):

        for k in range(2,50):

            if i==j**k:

                ans=j**k

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

if x==1:

    print((1))

    exit()



i=2

ans=0

while i*i<x:

    j=2

    while i**j<=x:

        ans=max(ans,i**j)

        j +=1

    i += 1

print(ans)
x = int(eval(input()))
ans = 1
for i in range(1, x + 1):
    for j in range(2, 50):
        for k in range(2, 50):
            if i == j**k:
                ans = j**k
print(ans)

x = int(eval(input()))
if x == 1:
    print((1))
    exit()
i = 2
ans = 0
while i * i < x:
    j = 2
    while i**j <= x:
        ans = max(ans, i**j)
        j += 1
    i += 1
print(ans)

-ans = 1 -for i in range(1, x + 1): -    for j in range(2, 50): -        for k in range(2, 50): -            if i == j**k: -                ans = j**k +if x == 1: +    print((1)) +    exit() +i = 2 +ans = 0 +while i * i < x: +    j = 2 +    while i**j <= x: +        ans = max(ans, i**j) +        j += 1 +    i += 1