X = int(eval(input()))

ans = 0

for b in range(X + 1):

	for p in range(2, 10):  #2^10=1024

		tmp = b ** p

		if tmp <= X and tmp > ans:

			ans = tmp

print(ans)

from bisect import bisect_right



expo = sorted(list(set([b**p for b in range(1, int(1000**0.5)+1) for p in range(2, 10) if b**p <= 1000])))

X = int(eval(input()))



print((expo[bisect_right(expo, X)-1]))

X = int(eval(input()))
ans = 0
for b in range(X + 1):
    for p in range(2, 10):  # 2^10=1024
        tmp = b**p
        if tmp <= X and tmp > ans:
            ans = tmp
print(ans)

from bisect import bisect_right

expo = sorted(
    list(
        set(
            [
                b**p
                for b in range(1, int(1000**0.5) + 1)
                for p in range(2, 10)
                if b**p <= 1000
            ]
        )
    )
)
X = int(eval(input()))
print((expo[bisect_right(expo, X) - 1]))

+from bisect import bisect_right + +expo = sorted( +    list( +        set( +            [ +                b**p +                for b in range(1, int(1000**0.5) + 1) +                for p in range(2, 10) +                if b**p <= 1000 +            ] +        ) +    ) +) -ans = 0 -for b in range(X + 1): -    for p in range(2, 10):  # 2^10=1024 -        tmp = b**p -        if tmp <= X and tmp > ans: -            ans = tmp -print(ans) +print((expo[bisect_right(expo, X) - 1]))