X = int(eval(input()))



ans = 0

for i in range(1, 100):

    for j in range(2, 100):

        if i ** j <= X:

            ans = max(ans, i ** j)



print(ans)

X = int(eval(input()))



ans = 1

for b in range(2, 40):

    p = 2

    while True:

        val = b ** p

        if val > X:

            break

        ans = max(ans, val)

        p += 1



print(ans)

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

X = int(eval(input()))
ans = 1
for b in range(2, 40):
    p = 2
    while True:
        val = b**p
        if val > X:
            break
        ans = max(ans, val)
        p += 1
print(ans)

-ans = 0 -for i in range(1, 100): -    for j in range(2, 100): -        if i**j <= X: -            ans = max(ans, i**j) +ans = 1 +for b in range(2, 40): +    p = 2 +    while True: +        val = b**p +        if val > X: +            break +        ans = max(ans, val) +        p += 1