import math

x = int(eval(input()))



L = []

for i in range(2,int(math.floor(math.sqrt(x)))+1):

  for j in range(x//i + 1):

    if i ** j <= x:

      L.append(i ** j)

      

if L == []:

  print("1")

else:

  print((max(L)))

import math

x = int(eval(input()))

if x == 1 or x== 2 or x==3:

  print((1))

  exit()



s = math.floor(math.sqrt(x))



def l(k,p):

    return(int(math.floor(math.log(p)/math.log(k))))



ans = 0

for i in range(2,s+1):

  if i ** (1 + l(i,x)) <= x:

    ans = max(ans, i ** (1+l(i,x)))

  else:

    ans = max(ans, i ** l(i,x))

  if ans == x:

    print(x)

    exit()

  

print(ans)
import math

x = int(eval(input()))
L = []
for i in range(2, int(math.floor(math.sqrt(x))) + 1):
    for j in range(x // i + 1):
        if i**j <= x:
            L.append(i**j)
if L == []:
    print("1")
else:
    print((max(L)))

import math

x = int(eval(input()))
if x == 1 or x == 2 or x == 3:
    print((1))
    exit()
s = math.floor(math.sqrt(x))


def l(k, p):
    return int(math.floor(math.log(p) / math.log(k)))


ans = 0
for i in range(2, s + 1):
    if i ** (1 + l(i, x)) <= x:
        ans = max(ans, i ** (1 + l(i, x)))
    else:
        ans = max(ans, i ** l(i, x))
    if ans == x:
        print(x)
        exit()
print(ans)

-L = [] -for i in range(2, int(math.floor(math.sqrt(x))) + 1): -    for j in range(x // i + 1): -        if i**j <= x: -            L.append(i**j) -if L == []: -    print("1") -else: -    print((max(L))) +if x == 1 or x == 2 or x == 3: +    print((1)) +    exit() +s = math.floor(math.sqrt(x)) + + +def l(k, p): +    return int(math.floor(math.log(p) / math.log(k))) + + +ans = 0 +for i in range(2, s + 1): +    if i ** (1 + l(i, x)) <= x: +        ans = max(ans, i ** (1 + l(i, x))) +    else: +        ans = max(ans, i ** l(i, x)) +    if ans == x: +        print(x) +        exit() +print(ans)