from bisect import bisect_right





cands = []

for i in range(2, 400):

    cur = i

    while cur * i <= 1000:

        cands.append(cur * i)

        cur *= i

cands.sort()



X = int(eval(input()))

if X == 1:

    print((1))

else:

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

X = int(eval(input()))

ans = 1

for i in range(2, 32):

    for j in range(2, 10):

        if i ** j > X:

            continue

        ans = max(ans, i ** j)

print(ans)

from bisect import bisect_right

cands = []
for i in range(2, 400):
    cur = i
    while cur * i <= 1000:
        cands.append(cur * i)
        cur *= i
cands.sort()
X = int(eval(input()))
if X == 1:
    print((1))
else:
    print((cands[bisect_right(cands, X) - 1]))

X = int(eval(input()))
ans = 1
for i in range(2, 32):
    for j in range(2, 10):
        if i**j > X:
            continue
        ans = max(ans, i**j)
print(ans)

-from bisect import bisect_right - -cands = [] -for i in range(2, 400): -    cur = i -    while cur * i <= 1000: -        cands.append(cur * i) -        cur *= i -cands.sort() -if X == 1: -    print((1)) -else: -    print((cands[bisect_right(cands, X) - 1])) +ans = 1 +for i in range(2, 32): +    for j in range(2, 10): +        if i**j > X: +            continue +        ans = max(ans, i**j) +print(ans)