X = int(eval(input()))

ans = 1

for i in range(2,int(X**0.5)+1):

    cnt = 2

    y = i**cnt

    while y<=X:

        ans = max(ans,y)

        cnt +=1

        y = y*i

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

if X==1:

    print((1))

else:

    cmax = 0

    for i in range(2,int(X**0.5)+1):

        k = 2

        while i**k<=X:

            k += 1

        cmax = max(cmax,i**(k-1))

    print(cmax)
X = int(eval(input()))
ans = 1
for i in range(2, int(X**0.5) + 1):
    cnt = 2
    y = i**cnt
    while y <= X:
        ans = max(ans, y)
        cnt += 1
        y = y * i
print(ans)

X = int(eval(input()))
if X == 1:
    print((1))
else:
    cmax = 0
    for i in range(2, int(X**0.5) + 1):
        k = 2
        while i**k <= X:
            k += 1
        cmax = max(cmax, i ** (k - 1))
    print(cmax)

-ans = 1 -for i in range(2, int(X**0.5) + 1): -    cnt = 2 -    y = i**cnt -    while y <= X: -        ans = max(ans, y) -        cnt += 1 -        y = y * i -print(ans) +if X == 1: +    print((1)) +else: +    cmax = 0 +    for i in range(2, int(X**0.5) + 1): +        k = 2 +        while i**k <= X: +            k += 1 +        cmax = max(cmax, i ** (k - 1)) +    print(cmax)