CodeEff/ECCO huggingface dataset:
# Original solution
x = int(eval(input()))
y = []
for i in range(1,33):
  for j in range(2,11):
    y.append(i**j)
    
ans = 1
for i in y:
  if i <= x:
    ans = max(ans, i)
print(ans)

# Optimized solution
x = int(eval(input()))
y = []
for i in range(1,33):
  for j in range(2,11):
    if i**j <= x:
      y.append(i**j)
print((max(y)))
# Original solution
from math import floor, log, sqrt


def solve(string):
    x = int(string)
    ans = [1] + [i**int(log(x, i)) for i in range(2, floor(sqrt(x)) + 2)]
    return str(max(ans)) if x != 243 else "243"


if __name__ == '__main__':
    print((solve(eval(input()))))


# Optimized solution
from math import ceil, floor, log, sqrt


def solve(string):
    x = int(string)
    ans = [1]
    for i in range(2, floor(sqrt(x)) + 1):
        ans.append(i**floor(log(x, i)))
        if i**ceil(log(x, i)) <= x:
            ans.append(i**ceil(log(x, i)))
    return str(max(ans))


if __name__ == '__main__':
    print((solve(eval(input()))))
# Original solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(eval(input()))
    ans=0
    for i in range(1,33):
        for j in range(2,11):
            y=i**j
            if y<x:
                ans=max(y,ans)
            elif y==x:
                ans=max(y,ans)
                break
            else:
                break
    print(ans)
resolve()


# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(eval(input()))
    ans=0
    for i in range(1,33):
        if i>x:
            break
        for j in range(2,11):
            y=i**j
            if y<x:
                ans=max(y,ans)
            elif y==x:
                ans=max(y,ans)
                break
            else:
                break
    print(ans)
resolve()
# Original solution
x = int(eval(input()))
ans = []
if x == 1:
    print((1))
    exit()

for i in range(1, x + 1):
    for j in range(2, 101):
        for k in range(2, 101):
            number = j ** k
            if number == i:
                ans.append(i)
print((max(ans)))


# Optimized solution
x = int(eval(input()))
if x == 1:
    print((1))
    exit()

for i in reversed(list(range(1, x + 1))):
    for j in range(2, 101):
        for k in range(2, 101):
            number = j ** k
            if number == i:
                print(i)
                exit()
# Original solution
# ABC097B - Exponential
def main():
    X = int(eval(input()))
    cand = {1}
    for i in range(2, int(X ** 0.5) + 1):
        p = 2
        while i ** p <= X:
            cand.add(i ** p)
            p += 1
    ans = max(cand)
    print(ans)


if __name__ == "__main__":
    main()

# Optimized solution
# ABC097B - Exponential
def main():
    X = int(eval(input()))
    cand = [1]
    for i in range(2, int(X ** 0.5) + 1):
        p = 2
        while i ** p <= X:
            cand.append(i ** p)
            p += 1
    ans = max(cand)
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
X=int(eval(input()))
n=1
for b in range(2,X):
   p=2
   while(True):
      x=b**p
      if x<=X:
         n=max(x,n)
         p+=1
      else:
         break
   
print(n)

# Optimized solution
def main():
    X=int(eval(input()))
    if X==1 or X==2 or X==3:
        print((1))
    else:
        li=[]
        for p in range(2,10):
            for n in range(2,100):
                if n**p<=X:
                    li.append(n**p)
                else:
                    break
        li.sort(reverse=True)
        print((li[0]))
if __name__=="__main__":
    main()
# Original solution
x = int(eval(input()))

ans = 0
for i in range(1, x+2):
    for j in range(2, x+2):
        if i**j <= x:
            ans = max(ans, i**j)
        else:
            break

print(ans)

# Optimized solution
x = int(eval(input()))

ans = 1
for i in range(2, x+1):
    for j in range(2, x+1):
        if i**j <= x:
            ans = max(ans, i**j)
        else:
            break

print(ans)
# Original solution
x = int(eval(input()))
ans = 0
for b in range(1, x//2):
    for p in range(2, x):
        if b**p <= x:
            ans = max(ans, b**p)
        else:
            continue
if x == 1:
    ans = 1
print(ans)

# Optimized solution
x = int(eval(input()))
ans = 1
for b in range(1, x):
    for p in range(2, x):
        if b**p <= x:
            ans = max(ans, b**p)
        else:
            break
print(ans)
# Original solution
x=int(eval(input()))

for i in range(x,-1,-1):
  for k in range(int(i**0.5)+1):
    for j in range(11):
      if k**j>i:
        break
      if k**j==i:
        print(i)
        exit()

# Optimized solution
x=int(eval(input()))

ans=1
for i in range(1,x):
  for j in range(2,x):
    if i**j>x:
      break
    ans=max(ans,i**j)
print(ans)
# Original solution
def is_perfect_power(n):
    if n == 1:
        return True
    div = 2
    divs = []
    while n != 1:
        if n % div == 0:
            n //= div
            divs.append(div)
        else:
            div += 1
    divs_d = {d: 0 for d in set(divs)}
    for d in divs:
        divs_d[d] += 1
    divs_s = {n for n in list(divs_d.values())}
    if min(divs_s) > 1:
        for d in divs_s:
            if d % min(divs_s) != 0:
                return False
    else:
        return False
    return True


X = int(eval(input()))
for x in range(X, 0, -1):
    if is_perfect_power(x):
        print(x)
        break


# Optimized solution
def is_perfect_power(n):
    return n in {
        1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144,
        169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512,
        529, 576, 625, 676, 729, 784, 841, 900, 961, 1000
    }


X = int(eval(input()))
for x in range(X, 0, -1):
    if is_perfect_power(x):
        print(x)
        break
# Original solution
x, mx = int(eval(input())), 1
for i in range(2,x+1):
    for j in range(2,100):
        if i**j<=x: mx=max(mx, i**j)
print(mx)

# Optimized solution
beki = [0] * 1010
beki[1] = 1
for i in range(2, 1001):
        t = i*i
        while t<1001:
                beki[t] = 1
                t *= i
ans = 1
for i in range(int(eval(input()))+1):
        if beki[i]: ans = i
print(ans)
# Original solution
x = int(eval(input()))

num = 0
if x == 1:
    num = 1
else:
    for b in range(2,x):
        for p in range(2,11):
            tmp = pow(b, p)
            if tmp <= x and num < tmp:
                num = tmp

print(num)

# Optimized solution
x = int(eval(input()))

num = 0
if x == 1:
    num = 1
else:
    for b in range(2, 33):
        for p in range(2, 11):
            tmp = pow(b, p)
            if tmp <= x and num < tmp:
                num = tmp

print(num)
# Original solution
X = int(eval(input()))

s = [1]
for i in range(X+1):
    for j in range(2,X+1):
        if i**j <= X and i**j not in s:
            s.append(i**j)
        if i**j > X:
            break
print((max(s))) 

# Optimized solution
X = int(eval(input()))
A = [False]*1001
A[1] = True
for i in range(2,1001):
    j = 2
    while i**j < 1001:
        A[i**j] = True
        j += 1

ans = 1
for i in range(X,-1,-1):
    if A[i]:
        ans = i
        break

print(ans)
# Original solution
import math
X = int(eval(input()))
max = 0
x = math.floor(math.sqrt(X))
for b in range(x + 1):
    for p in range(x + 1):
        # print(b**p)
        if(max < b**p <= X):
            max = b**p
print(max)


# Optimized solution
import math
X = int(eval(input()))
max = 0
bRange = math.floor(math.sqrt(X))
pRange = math.floor(math.log(X,2))
for b in range(bRange + 1):
    for p in range(pRange + 1):
        # print(b**p)
        if(max < b**p <= X):
            max = b**p
print(max)
# Original solution
X = int(eval(input()))
ans = 1
t = min(X, 100)
for b in range(1, t):
    for p in range(1, t):
        if b**p > ans and b**p <= X:
            ans = b**p
print(ans)


# Optimized solution
X = int(eval(input()))
ans = 1
for b in range(1, X+1):
    for p in range(2, X+1):
        if b**p > X:
            break
        if b**p > ans and b**p <= X:
            ans = b**p
print(ans)
# Original solution
x = int(eval(input()))
ans = 1
for b in range(1, 1001):
    for p in range(2, 11):
        now = b ** p
        if now <= x:
            ans = max(ans, now)
print(ans)

# Optimized solution
X = int(eval(input()))
ans = 0
for b in range(1, 32):
    for p in range(2, 10):
        exp = b ** p
        if exp <= X:
            ans = max(ans, exp)
print(ans)
# Original solution
x = int(eval(input()))

for i in range(x, 0, -1):
    for j in range(2, i):
        s = i
        while s%j == 0:
            t = s % j
            s = s // j
            if s == 1 and t == 0:
                print(i)
                exit()       
print((1))

# Optimized solution
x = int(eval(input()))
ans = [1]
for i in range(2, x):
    for j in range(2,11):
        ad = i**j
        if ad > x:
            break
        ans.append(ad)
print((max(ans)))
# Original solution
x =int(eval(input()))
for n in range(x, 0, -1):
    for b in range(1, n + 1):
        for p in range(2, n + 1):
            if b ** p == n:
                print(n)
                exit()
            elif b ** p > n:
                break
print((1))


# Optimized solution
X = int(eval(input()))
ans = 1

for i in range(2, X + 1):
    j = 2
    while i ** j <= X:
        ans = max(ans, i ** j)
        j += 1

print(ans)
# Original solution
X=int(eval(input()))
s=[]
for i in range(1,100,+1):
    for j in range(2,100,+1):
     if i**j<=X:
        s.append(i**j)
print((max(s)))



# Optimized solution
n=int(eval(input()))

a=[1]
for i in range(2,33):
	for j in range(2,11):
		x=i**j
		if x<=1000:
			a.append(x)

a=list(set(a))
a.sort()
	
def binarySearch(value, xList):
    low=0
    high=len(xList)
    while low!=high:
        mid=(low+high)//2
        if xList[mid]<=value:
            low=mid+1
        else:
            high=mid
    return xList[low-1]
		
print((binarySearch(n,a)))
# Original solution
import sys
import math

def isExponential(i : int) -> bool:
    #math.ceil(math.sqrt(i))+1
    for j in range(2,i):       
        devidend = i
        devisor = j
        #print(devidend,devisor,"inFor") 
        while 1:
            #print(devidend,devisor,"inWhile")
            if devidend % devisor != 0:
                break
            else:
                if devidend == devisor:
                    return True
                else:
                    devidend //= devisor
    return False

x = int(eval(input()))
if x == 1:
    print((1))
for i in range(x,0,-1):
    if isExponential(i) == True:
        print(i)
        #print("wtf")
        break

# Optimized solution
import sys
import math

def isExponential(i : int) -> bool:
    for j in range(2,math.ceil(math.sqrt(i))+1):       
        devidend = i
        devisor = j
        #print(devidend,devisor,"inFor") 
        while 1:
            #print(devidend,devisor,"inWhile")
            if devidend % devisor != 0:
                break
            else:
                if devidend == devisor:
                    return True
                else:
                    devidend //= devisor
    return False

x = int(eval(input()))
if x == 1:
    print((1))
for i in range(x,0,-1):
    if isExponential(i) == True:
        print(i)
        #print("wtf")
        break
# Original solution
X = int(eval(input()))
ans = 1
for b in range(1, 100):
  for p in range(2, 10):
    if ans < pow(b, p) and pow(b, p) <= X:
      ans = pow(b, p)
print(ans)

# Optimized solution
X = int(eval(input()))
ans = 1
if X > 1:
  for b in range(1, 32):
    for p in range(2, 11):
      if ans <= X and pow(b, p) <= X:
      	ans = max(ans, pow(b, p))
print(ans)
# Original solution
import math
X = int(eval(input()))
def expo(x):
    ans = 1
    for i in reversed(list(range(1,x+1))):
        for j in range(int(math.sqrt(x))+1):
            for k in range(2,x+1):
                if i == j**k:
                    ans = i
                    return ans
    return ans
print((expo(X)))

# Optimized solution
#B - Exponential
import math
X = int(eval(input()))
def expo(x):
    ans = 1
    for i in reversed(list(range(1,x+1))):
        for j in range(int(math.sqrt(x))+1):
            for k in range(2,int(math.sqrt(x))):
                if i == j**k:
                    ans = i
                    return ans
    return ans
print((expo(X)))
# Original solution
x = int(eval(input()))

s = set([1])
for i in range(2,501):
    for j in range(2,501):
        if (i**j) <= x:
            s.add(i**j)

print((max(list(s))))

# Optimized solution
x = int(eval(input()))

s = set([1])
for i in range(2,501):
    for j in range(2,10):
        if (i**j) <= x:
            s.add(i**j)

print((max(list(s))))
# Original solution
x = int(eval(input()))
y = 0
if x==1 or x==2 or x==3:
    print((1))
    exit()
else:
    for a in range(2,(x+1)):
        for b in range (2,10):
            if b==2 and a**b>x:
                print(y)
                exit()
            elif a**b<=x:
                y=max(a**b,y)


# Optimized solution
x = int(eval(input()))
y = 0
if x==1 or x==2 or x==3 or x==4:
    print((1))
    exit()
else:
    for a in range(2,(x+1)):
        for b in range (2,10):
            if b==2 and a**b>x:
                print(y)
                exit()
            elif a**b<=x:
                y=max(a**b,y)
# Original solution
x = int(eval(input()))

## まず、1000以下のべき乗数のリストを作る
# print(2**9) -> 512
beki_list = []
for i in range(1, 101): # ベース
    for j in range(2, 10): # ベースにべき乗する数
        beki = i**j
        if beki <= 1000:
            beki_list.append(beki)

# 存在する1000以下のべき乗数を、大きい順に比較していく
beki_list.sort(reverse=True)

for beki in beki_list:
    if beki <= x:
        print(beki)
        exit()

# Optimized solution
x = int(eval(input()))

beki_list = []
for i in range(1, 32): # ベース
    for j in range(2, 10): # ベースにべき乗する数
        beki = i**j
        if beki <= 1000:
            beki_list.append(beki)


# 存在する1000以下のべき乗数を、大きい順に比較していく
beki_list.sort(reverse=True)

for beki in beki_list:
    if beki <= x:
        print(beki)
        exit()
# Original solution
def solve():
    x = int(eval(input()))
    if x < 4:
        return 1
    elif x < 8:
        return 4
    elif x < 9:
        return 8
    l = [i**j for i in range(1,x+1) for j in range(2,int(x**0.5)) if i**j<=x]
    return max(l)
        
if __name__ == '__main__':
    print((solve()))

# Optimized solution
x = int(eval(input()))
l = [i**j for i in range(1,33) for j in range(2,10) if i**j <= x]
print((max(l)))
# Original solution

x = int(eval(input()))
bekis = set()
bekis.add(1)

ans = 1
for b in range(2,35):
    for p in range(2,11):
        num = pow(b,p)
        if num <= x:
            ans = max(ans,num)
        else:
            break
print(ans)

# Optimized solution
x = int(eval(input()))
ans = 0
for i in range(33):
    for j in range(2,11):
        if pow(i,j) > x: break
        ans = max(ans,pow(i,j))

print(ans)
# Original solution
X=int(eval(input()))
res=1
for i in range(1,X+1):
    for j in range(2,11):
        for k in range(35):
            if i==k**j:
                res=i
print(res)


# Optimized solution
X=int(eval(input()))
l=[]
for i in range(1,X+1):
    for j in range(2,11):
        if i**j>X:
            break
        l.append(i**j)
l.sort()
print((l[-1]))
# Original solution
l=[0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]
for i in range(int(eval(input())),0,-1):
  if l[i]==1:print(i);break

# Optimized solution
x,l=int(eval(input())),[0]*1001;l[1]=1
for i in range(2,x+1):
  if l[i]==0:j=i*i
  while 1:
    if j>x:break
    else:l[j]=1;j*=i
for i in range(x,-1,-1):
  if l[i]==1:print(i);break
# Original solution
x=int(eval(input()))
ans=1
for i in range(1,x+1):
    for j in range(2,50):
        for k in range(2,50):
            if i==j**k:
                ans=j**k
print(ans)

# Optimized solution
x=int(eval(input()))
if x==1:
    print((1))
    exit()

i=2
ans=0
while i*i<x:
    j=2
    while i**j<=x:
        ans=max(ans,i**j)
        j +=1
    i += 1
print(ans)
# Original solution
x=int(eval(input()))
if x==1:
    print((1))
    exit()

i=2
ans=0
while i*i<x:
    j=2
    while i**j<=x:
        ans=max(ans,i**j)
        j +=1
    i += 1
print(ans)

# Optimized solution
x=int(eval(input()))
ans=1
for b in range(2,32):
    for p in range(2,10):
        if b**p>x:
            break
        else:
            if b**p>ans:
                ans=b**p
print(ans)
# Original solution
x = int(eval(input()))
ans = 1 # 1^b = 1
for i in range(2, x+1): # [2,x]
    a = i # a^1
    while a < x:
        a *= i # a^b,(b>=2)
        if a <= x: ans = max(ans, a)
print(ans)


# Optimized solution
import math
x = int(eval(input()))
ans = 1 # 1^b = 1
n = math.floor(math.sqrt(x))
for i in range(2, n+1): # [2,n]
    a = i # a^1
    while a < x:
        a *= i # a^b,(b>=2)
        if a <= x: ans = max(ans, a)
print(ans)
# Original solution
X = int(eval(input()))
b = 1
p = 2
ans = 0
for b in range(1, X + 1):
    for p in range(2, 10):
        if b ** p <= X:
            ans = max(ans, b ** p)

print(ans)


# Optimized solution
X = int(eval(input()))

ans = 1
for b in range(1, X + 1):
    for p in range(2, X + 1):
        if b ** p <= X:
            ans = max(ans, b ** p)
        else:
            break

print(ans)
# Original solution
X = int(eval(input()))

ans = 0
for i in range(1,1001):
    for j in range(2,11):
        tmp = i ** j
        if tmp <= X:
            ans = max(ans, i ** j)

print(ans)

# Optimized solution
X = int(eval(input()))

ans = 1
for i in range(2,int(X**.5)+1):
    j = 2
    while i ** j <= X:
        ans = max(ans, i ** j)
        j += 1

print(ans)
# Original solution
def main():
    from bisect import bisect_left

    x = int(eval(input()))

    cands = [1]
    for b in range(2, x + 1):
        for p in range(2, x + 1):
            pw = b ** p
            if pw > x: break
            cands.append(pw)

    cands.sort()

    i = bisect_left(cands, x)
    if i == len(cands) or x < cands[i]:
        i -= 1
    print((cands[i]))


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


# Optimized solution
def main():
    x = int(eval(input()))

    ans = 1
    for b in range(2, x + 1):
        for p in range(2, x + 1):
            cand = b ** p
            if cand > x: break
            ans = max(ans, cand)
    print(ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok
# Original solution
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)))    

# Optimized solution
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)
# Original solution
import sys
X = int(eval(input()))
res = 0
for b in range(1, -(-X//2)+1):
    for p in range(2, -(-X//2)+2):
        val = b**p
        if (val <= X) and (val > res):
            res = val
print(res)


# Optimized solution
import math
X = int(eval(input()))
res = 0
for b in range(1, int(math.sqrt(X))+1):
    for p in range(2, int(math.sqrt(X))+2):
        val = b**p
        if (val <= X) and (val > res):
            res = val
print(res)
# Original solution
import math

X = int(eval(input()))
answer = 1
for i in range(X+1):
    for j in range(2, X+1):
        if i ** j <= X:
            answer = max(answer, i ** j)
        else:
            break
print(answer)


# Optimized solution
X = int(eval(input()))

answer = 1
for i in range(2, X+1):
    j = 2
    while i**j <= X:
        answer = max(answer, i**j)
        j += 1
print(answer)
# Original solution
import math
X = int(eval(input()))
i_max = math.floor(math.sqrt(X))

result = 1
for i in range(2,i_max+1,1):
    for j in range(1,X):
        n = (i**j)
        if (n > X):
            break
        else:
            result = max(result, n)

print(result)


# Optimized solution
import math
X = int(eval(input()))
i_max = math.floor(math.sqrt(X))

result = 1
for i in range(2,i_max+1,1):
    for j in range(2,X):
        n = (i**j)
        if (n > X):
            break
        else:
            result = max(result, n)

print(result)
# Original solution
x = int(eval(input()))
a = 0
for i in range(1,x+1):
    for j in range(2,10):
        if i**j <= x:
            a = max(a,i**j)
print(a)

# Optimized solution
x = int(eval(input()))
a = 1
for i in range(1,x):
    for j in range(2,x):
        if i**j <= x:
            a = max(a,i**j)
        else:
          break
print(a)
# Original solution
x = int(eval(input()))
a = 1
for i in range(1,x):
    for j in range(2,x):
        if i**j <= x:
            a = max(a,i**j)
        else:
          break
print(a)

# Optimized solution
x = int(eval(input()))
a = 1
for i in range(2,x):
    j = 2
    while i**j <= x:
        a = max(a,i**j)
        j += 1
print(a)
# Original solution

list1=[1,2,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,100,1000,121]
num=eval(input())
num=int(num)

for i in range(12,32):
    list1.append(i**2)
    i+=1
list2=[]
for j in range(len(list1)):
    if num>=list1[j]:
        list2.append(list1[j])
        j +=1
        
print((max(list2)))
    

# Optimized solution
list1=[]
for b in range(1,33):
    for p in range(2,11):
        if b**p not in list1 and b**p<=1000:
            list1.append(b**p)
        elif b**p>1000:
            break
list1.sort()
N=int(eval(input()))
ans=0
for i in range(len(list1)):
    if list1[i]<=N:
        ans=list1[i]
    else:
        break
print(ans)