x = int(eval(input()))

ans = [b**p for b in range(1001) for p in range(2,10)

      if b**p <= x]

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



ans = 1

for i in range(2, X):

  n = i*i

  while n <= X:

    ans = max(ans, n)

    n *= i

print(ans)    

  
x = int(eval(input()))
ans = [b**p for b in range(1001) for p in range(2, 10) if b ** p <= x]
print((max(ans)))

X = int(eval(input()))
ans = 1
for i in range(2, X):
    n = i * i
    while n <= X:
        ans = max(ans, n)
        n *= i
print(ans)

-x = int(eval(input())) -ans = [b**p for b in range(1001) for p in range(2, 10) if b ** p <= x] -print((max(ans))) +X = int(eval(input())) +ans = 1 +for i in range(2, X): +    n = i * i +    while n <= X: +        ans = max(ans, n) +        n *= i +print(ans)