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.
N = int(input())
l = {1}
for i in range(2,32):
  j = 1
  while(i ** j <= N):
    l.add(i ** j)
    j += 1

for i in range(N, 0, -1):
  if(i in l):
    print(i)
    break
N = int(input())
l = {1}
for i in range(2,32):
  j = 2
  while(i ** j <= N):
    l.add(i ** j)
    j += 1

for i in range(N, 0, -1):
  if(i in l):
    print(i)
    break