n = int(eval(input()))

s = set()

for i in range(1, 32):

    s.add(i ** 2)



for i in range(1, 11):

    s.add(i ** 3)



for i in range(1, 7):

    s.add(i ** 4)



for i in range(1, 5):

    s.add(i ** 5)

    s.add(i ** 6)

    s.add(i ** 7)

    s.add(i ** 8)

    s.add(i ** 9)

    s.add(i ** 10)



t = list(s)

t.sort()

t = [x for x in t if x <= 1000]



res = 0

for tt in t:

    res = tt if tt <= n else res

print(res)
n = int(eval(input()))

t = [1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100,

     125, 121, 128, 144, 169, 196, 216, 225, 243, 256,

     289, 324, 343, 361, 400, 441, 484, 512, 529, 576,

     625, 676, 729, 784, 841, 900, 961, 1000, 1024, 1296]



res = 0

for tt in t:

    res = tt if tt <= n else res

print(res)

n = int(eval(input()))
s = set()
for i in range(1, 32):
    s.add(i**2)
for i in range(1, 11):
    s.add(i**3)
for i in range(1, 7):
    s.add(i**4)
for i in range(1, 5):
    s.add(i**5)
    s.add(i**6)
    s.add(i**7)
    s.add(i**8)
    s.add(i**9)
    s.add(i**10)
t = list(s)
t.sort()
t = [x for x in t if x <= 1000]
res = 0
for tt in t:
    res = tt if tt <= n else res
print(res)

n = int(eval(input()))
t = [
    1,
    4,
    8,
    9,
    16,
    25,
    27,
    32,
    36,
    49,
    64,
    81,
    100,
    125,
    121,
    128,
    144,
    169,
    196,
    216,
    225,
    243,
    256,
    289,
    324,
    343,
    361,
    400,
    441,
    484,
    512,
    529,
    576,
    625,
    676,
    729,
    784,
    841,
    900,
    961,
    1000,
    1024,
    1296,
]
res = 0
for tt in t:
    res = tt if tt <= n else res
print(res)

-s = set() -for i in range(1, 32): -    s.add(i**2) -for i in range(1, 11): -    s.add(i**3) -for i in range(1, 7): -    s.add(i**4) -for i in range(1, 5): -    s.add(i**5) -    s.add(i**6) -    s.add(i**7) -    s.add(i**8) -    s.add(i**9) -    s.add(i**10) -t = list(s) -t.sort() -t = [x for x in t if x <= 1000] +t = [ +    1, +    4, +    8, +    9, +    16, +    25, +    27, +    32, +    36, +    49, +    64, +    81, +    100, +    125, +    121, +    128, +    144, +    169, +    196, +    216, +    225, +    243, +    256, +    289, +    324, +    343, +    361, +    400, +    441, +    484, +    512, +    529, +    576, +    625, +    676, +    729, +    784, +    841, +    900, +    961, +    1000, +    1024, +    1296, +]