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())
Powers = [1]
for i in range(2,32):
  k = i
  while k<=1000:
    Powers += [k]
    k *= i
Powers.sort(reverse = True)
for power in Powers:
  if power <= x:
    print(power)
    break
x = int(input())
Powers = [1]
for i in range(2,32):
  k = i**2
  while k<=1000:
    Powers += [k]
    k *= i
Powers.sort(reverse = True)
for power in Powers:
  if power <= x:
    print(power)
    break