def ans(n):

    pow_2 = int(n**(0.5))

    pow_exeption = [32,128,243]

    #print(pow_2)

    ans = pow_2**2

    for i in pow_exeption:

        if i <= n:

            ans = max(i,ans)

    for i in range(1,11):

        if i**3 <= n:

            ans = max((i**3),ans)

        

    return(ans)

n = int(eval(input()))

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

    print((ans(i)))
#!/usr/bin/env python3

x = int(eval(input()))

ans = 1

for i in range(2,int(x**1/2) + 1):

    p = 2

    while True:

        if i**p > x: break

        else:

            ans = max(ans,i**p)

            p += 1

print(ans)
def ans(n):
    pow_2 = int(n ** (0.5))
    pow_exeption = [32, 128, 243]
    # print(pow_2)
    ans = pow_2**2
    for i in pow_exeption:
        if i <= n:
            ans = max(i, ans)
    for i in range(1, 11):
        if i**3 <= n:
            ans = max((i**3), ans)
    return ans


n = int(eval(input()))
for i in range(n, n + 1):
    print((ans(i)))

#!/usr/bin/env python3
x = int(eval(input()))
ans = 1
for i in range(2, int(x**1 / 2) + 1):
    p = 2
    while True:
        if i**p > x:
            break
        else:
            ans = max(ans, i**p)
            p += 1
print(ans)

-def ans(n): -    pow_2 = int(n ** (0.5)) -    pow_exeption = [32, 128, 243] -    # print(pow_2) -    ans = pow_2**2 -    for i in pow_exeption: -        if i <= n: -            ans = max(i, ans) -    for i in range(1, 11): -        if i**3 <= n: -            ans = max((i**3), ans) -    return ans - - -n = int(eval(input())) -for i in range(n, n + 1): -    print((ans(i))) +#!/usr/bin/env python3 +x = int(eval(input())) +ans = 1 +for i in range(2, int(x**1 / 2) + 1): +    p = 2 +    while True: +        if i**p > x: +            break +        else: +            ans = max(ans, i**p) +            p += 1 +print(ans)