You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.
x = int(input())
for i in range(33):
  if i**2>x:
    print(i**2)
    break
import sys
x = int(input())

m = 0
for i in range(33):
  for j in range(2,11):
    if i**j<=x:
      m = max(m,i**j)
print(m)