pow = [1]

for p in range(2,32):

  i=2

  while p**i<=1000:

    pow.append(p**i)

    i += 1

#print(pow)

X = int(eval(input()))

x = X

while x>0:

  if x in pow:

    ans = x

    break

  x -= 1

print(ans)
#素因数分解して列挙する関数、約数列挙ではない！

from collections import Counter

def factorize(n):

  b = 2

  fct = []

  while b * b <= n:

    while n % b == 0:

      n //= b

      fct.append(b)

    b = b + 1

  if n > 1:

    fct.append(n)

  f = list(Counter(fct).values())

  if 1 not in f and len(set(f))==1:

    return True

  return False



X = int(eval(input()))

for i in range(X,0,-1):

  f = factorize(i)

  if f==True or i==1:

    print(i)

    break
pow = [1]
for p in range(2, 32):
    i = 2
    while p**i <= 1000:
        pow.append(p**i)
        i += 1
# print(pow)
X = int(eval(input()))
x = X
while x > 0:
    if x in pow:
        ans = x
        break
    x -= 1
print(ans)

# 素因数分解して列挙する関数、約数列挙ではない！
from collections import Counter


def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    f = list(Counter(fct).values())
    if 1 not in f and len(set(f)) == 1:
        return True
    return False


X = int(eval(input()))
for i in range(X, 0, -1):
    f = factorize(i)
    if f == True or i == 1:
        print(i)
        break

-pow = [1] -for p in range(2, 32): -    i = 2 -    while p**i <= 1000: -        pow.append(p**i) -        i += 1 -# print(pow) +# 素因数分解して列挙する関数、約数列挙ではない！ +from collections import Counter + + +def factorize(n): +    b = 2 +    fct = [] +    while b * b <= n: +        while n % b == 0: +            n //= b +            fct.append(b) +        b = b + 1 +    if n > 1: +        fct.append(n) +    f = list(Counter(fct).values()) +    if 1 not in f and len(set(f)) == 1: +        return True +    return False + + -x = X -while x > 0: -    if x in pow: -        ans = x +for i in range(X, 0, -1): +    f = factorize(i) +    if f == True or i == 1: +        print(i) -    x -= 1 -print(ans)