x=int(eval(input()))

a=set()

for i in range(1,1001):

  for j in range(2,34):

    t=i**j

    if t<=x:

      a.add(i**j)

a=list(a)

a.sort()

print((a[-1]))
x=int(eval(input()))

ans=0

for i in range(1,35):

  for j in range(2,10):

    t=i**j

    if t<=x:

      ans=max(ans,t)

print(ans)







x = int(eval(input()))
a = set()
for i in range(1, 1001):
    for j in range(2, 34):
        t = i**j
        if t <= x:
            a.add(i**j)
a = list(a)
a.sort()
print((a[-1]))

x = int(eval(input()))
ans = 0
for i in range(1, 35):
    for j in range(2, 10):
        t = i**j
        if t <= x:
            ans = max(ans, t)
print(ans)

-a = set() -for i in range(1, 1001): -    for j in range(2, 34): +ans = 0 +for i in range(1, 35): +    for j in range(2, 10): -            a.add(i**j) -a = list(a) -a.sort() -print((a[-1])) +            ans = max(ans, t) +print(ans)