peterverebics/CodeNet_Python_118 huggingface dataset:
X = int(input())
b = 2
p = 2
ans = 1
for b in range(1, X+1):
    for p in range(2, X+1):
        beki = b ** p
        if beki <= X:
            ans = max(ans, beki)
        else:
            break
print(ans)
x=int(input())
c=1
for b in range(1,x):
    for p in range(2,x):
        if b**p<=x:
          c=max(c,b**p)
        else:
          break # b**pがx以上は計算を省く
print(c)
x = int(input())
ans = 1
for i in range(2,1000):
    tmp = 2
    while i**tmp <= x:
        ans = max(ans,i**tmp)
        tmp += 1
print(ans)
x=int(input())
a=1
for i in range(2,x):
    j=2
    while i**j<=x:
        a=max(a,i**j)
        j+=1
print(a)
X = int(input())
ans = []
ans.append(1)
for i in range(2, X):
    a = i*i
    while a <= X:
        ans.append(a)
        a *= i
print(max(ans))
x=int(input())
ans=1
for i in range(1, x):
    for j in range(2, x):
        if i**j<=x : ans=max(ans, i**j)
        else: break
print(ans)
X = int(input())
res = 1
for i in range(2,32):
    p = 2
    while i**p <= X:
        if res < i**p:
            res = i**p
        p += 1
print(res)
x = int(input())
a = []

for i in range(1,33):
    for j in range(2,9):
        tmp = i**j
        if tmp <= x:
            a.append(tmp)

print(max(a))
n = int(input())
s = set()
for i in range(1, 32):
    s.add(i ** 2)

for i in range(1, 11):
    s.add(i ** 3)

for i in range(1, 7):
    s.add(i ** 4)

for i in range(1, 5):
    s.add(i ** 5)
    s.add(i ** 6)
    s.add(i ** 7)
    s.add(i ** 8)
    s.add(i ** 9)
    s.add(i ** 10)

t = list(s)
t.sort()
t = [x for x in t if x <= 1000]

res = 0
for tt in t:
    res = tt if tt <= n else res
print(res)
X = int(input())
ans = 1
for i in range(1,X+1):
    for j in range(2,X+1):
        if i**j <= X:
            ans = max(ans,i**j)
        else:
            break
print(ans)
x=int(input())
li=[]
for i in range(32):
  for j in range(2,6):
    if pow(i,j)<=x:
      li.append(pow(i,j))
print(max(li))
import math
x = int(input())
ans = 1
for i in range(2, int(x ** 0.5) + 1):
    p = 1
    while i ** p <= x:
        p += 1
    ans = max(ans, i ** (p - 1))
print(ans)
x=int(input())

def pow(b,x):
    res=b
    while True:
        if res*b<=x:
            res=res*b
        else:
            break
    return res


ans=1
for i in range(2,x+1):
    if i**2<=x:
        ans=max(ans,pow(i,x))
print(ans)
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(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()
N = int(input())
li = []
for i in range(1,100):
    for j in range(2,20):
        if i**j<=10000:
            li.append(i**j)
li2 = list(set(li))
li2.sort()
ans = 0
for k in range(len(li2)):
    if (li2[k-1]<=N)&(li2[k]>N):
        ans = li2[k-1]
print(ans)
X=int(input())
a=[]

for i in range(32):
    for j in range(2,10):
        if i**j<= 1000:
            a.append(i**j)
            continue
        break

for i in sorted(list(set(a)))[::-1]:
    if i <= X:
        print(i)
        break
X = int(input())
ans = 1
i = 2
while i * i <= X:
    j = 1
    maxi = i
    while i ** j <= X:
        maxi = i ** j
        j += 1
    ans = max(ans, maxi)
    i += 1

print(ans)
x = int(input())
tmp = 1
for b in range(1, x):
    for p in range(2,x):
        if b**p <= x:
            tmp = max(tmp, b**p)
        else:
            break
print(tmp)
X = int(input())

lst=[1]
for p in range(2,10):
    i=2
    while i ** p <= X:
        lst.append(i ** p)
        i+=1
#print(lst)
print(max(lst))
n=int(input())
ans=0
if n==1:
    print(1)
    exit()


for i in range(n):
    for j in range(2,11):
        if i**j<=n:
           ans=max(ans,i**j) 
print(ans)
x=int(input())
i=1
mx=i
while(i**2<x):
  i+=1
  j=2
  while(i**j<=x):
    j+=1
  if i**(j-1)>mx:
    mx=i**(j-1)
print(mx)
def main():
    X = int(input())
    maxi = 1
    if X <= 2:
        print(1)
        return
    for b in range(2, X):
        for p in range(2, X):
            if b**p > X:
                break
            else:
                maxi = max(maxi, b**p)
    print(maxi)
main()
def m_pow(x, n) -> int:
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return (K * x)


ans = 1
x = int(input())
for i in range(2, 1001):
    for j in range(2, 1001):
        n = m_pow(i, j)
        if n <= x:
            ans = max(n, ans)
        else:
            break

print(ans)
def is_prime(n):
    if n <= 1:
        return False

    for i in range(2, n):
        if n % i == 0:
            return False

    return True

X = int(input())
lis = [i for i in range(1,34)]
num = []

for i in lis:
    for j in range(2, 11):
        if i**j <= X:
            num.append(i**j)

print(max(num))
x = int(input())
if x == 1:
    print(1)
    exit()
ans = 0
for n in range(2, x):
    i = 2
    while n ** i <= x:
        ans = max(ans, n ** i)
        i += 1
print(ans)
x = int(input())

bekijo = 1
for i in range(2,x+1):
    for j in range(2,x+1):
        if i ** j > x: break
        bekijo = max(bekijo, i**j)
        
print(bekijo)
X = int(input())
ans = 0
for i in range(1,int(X**0.5)+1):
  tmp = 0
  for j in range(2,11):
    y = i**j
    if y > X:
      break
    tmp = max(y,tmp)
  ans = max(tmp,ans)
print(ans)
x = int(input())
ans = 0
for i in range(1,32):
    for j in range(2,10):
        if i**j <= x:
            ans = max(ans,i**j)
print(ans)
x = int(input())

lst = []
for i in range(1,101):
    for j in range(2,10):
       lst.append(i**j)
lst.sort(reverse=True)

for n in lst:
    if n <= x:
        print(n)
        break
X = int(input())

if X < 4:
    print(1)
    exit()

ans = 1
for x in range(2,X-1):
    for p in range(2,X-1):
        if(x**p > X): break
        ans = max(ans, x**p)

print(ans)
x = int(input())
ans = 1
for i in range(x):
    for j in range(2, x):
        if x < i**j: break
        else: ans = max(ans, i**j)
print(ans)
import math

n = int(input())
ans = [1]
b = int(math.sqrt(n))
if b >= 2:
    for i in range(2,b+1):
        temp = i
        while True:
            temp*=i
            if temp <= n:
                ans.append(temp)
            else:
                break

print(max(ans))
x=int(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)
x = int(input())
s = []
for p in range(2, 11):
    for b in range(1, 1001):
        if b ** p <= x:
            s.append(b ** p)
        else:
            break
print(sorted(s)[-1])
X = int(input())

max_v = 1
b = 2
for i in range(2, X):
  b =i
  for j in range(2,X):
    p = j
    if b**p > max_v and b**p <= X:
      #print(b, p)
      max_v = b**p
    elif b**p > X:
      break
print(max_v)
import sys
X = int(input())
L = []
for i in range(1,32):
  for j in range(1,10):
    if X < i**j:
      if j != 2:
        L.append(i**(j-1))
        break
      break
    elif X == i**j and j != 1:
      print(i**j)
      sys.exit(0) #平方数忘れ
print(max(L))
X=int(input())
ans=1
for b in range(2,32):
    for p in range(2,10):
        if b**p>X:
            break
        else:
            if ans<b**p:
                ans=b**p
print(ans)
X = int(input())
ans = 0
for i in range(1,500):
  for j in range(2,10):
    if i**j<=X:
      ans = max([ans, i**j])
    else:
      break

print(ans)
x=int(input())
ans=[1]
for i in range(2,x+1):
    k=2
    while True:
        a=i**k
        if a<=x:
            ans.append(a)
            k+=1
        else:
            break
print(max(ans))
import bisect
X=int(input())
s=set()
for i in range(1,1000):
    for j in range(2,11):
        if(i**j<=X):
            s.add(i**j)
        else:
            break
li=sorted(s)
print(li[bisect.bisect_right(li,X)-1])
import sys
input = sys.stdin.readline

x = int(input())
ans = 1
for i in range(2, x + 1):
    j = i
    while True:
        j *= i
        if j > x:
            if abs(x - ans) >= abs(x - j//i) and j//i != i:
                ans = j//i
            break
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 = Counter(fct).values()
  if 1 not in f and len(set(f))==1:
    return True
  return False

X = int(input())
for i in range(X,0,-1):
  f = factorize(i)
  if f==True or i==1:
    print(i)
    break
x = int(input())
if x <= 3:
  print(1)
  exit()
res = 0
for i in range(2, 33):
  for j in range(2, 12):
    a = i ** j
    if a <= x:
      res = max(res, a)
print(res)
import math
x=int(input())
if x==1:
  print(1)
  exit()
  
ans = 0
for i in range(2,math.ceil(x**(0.5))):
  j=2
  tmp = i**j
  while tmp<=x:
    ans = max(ans, tmp)
    j+=1
    tmp = i**j
print(ans)
#!/usr/bin/env python3
x = int(input())
ans = 1
for i in range(2,int(x**1/2) + 1):
    p = 2
    while True:
        if i**p > x: break
        else:
            ans = max(ans,i**p)
            p += 1
print(ans)
x = int(input())

ans = 0
for i in range(1, 100):
    for j in range(2, 100):
        y = pow(i, j)
        if y <= x:
            ans = max(ans, y)

print(ans)
x = int(input())

if x ==1:
  print(1)
else:
  ans = []
  for i in range(1, x):
    for j in range(2, x//i):
      if i**j>x:
        break
      else:
        ans.append(i**j)
  
  print(max(ans))
X=int(input())
ans=0
for b in range(1,33):
	for p in range(2,11):
		if b**p<=X:
			ans=max(b**p,ans)
print(ans)
n=int(input())
ans=int(1)
for i in range(1,n):
    for j in range(2,10):
        if ans<=pow(i,j)<=n:
            ans=pow(i,j)

print(ans)
x = int(input())

li = [1]
for i in range(2,32):
    cnt = 2
    while i**cnt<=x:
        li += [i**cnt]
        cnt +=1

print(max(li))
x = int(input())
r = 1

for b in range(1, int(x**0.5 + 1)):
    for p in range(2, 11):
        if b**p > x:
            break
        r = max(r, b**p)
        
print(r)
x = int(input())
ans = 1
for i in range(1,int(x**0.5)+1):
    for j in range(2,x//2 + 1):
        if x >= i**j:
            ans = max(i**j, ans)


print(ans)
X = int(input())

max_expo = 1

for p in range(2,10):
  for b in range(X):
    if max_expo < (b**p) <= X:
      max_expo = (b**p)
print(max_expo)
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

x = int(input())
li = [1]
b = 2
for b in range(1,x+1):
    for p in range(2,11):
        if b**p<=x:
            li.append(b**p)
print(max(li))
X = int(input())
cmax = 1
for i in range(2,int(X**0.5)+1):
    k = 2
    while i**k<=X:
        cmax = max(cmax,i**k)
        k += 1
print(cmax)
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

x = ni()

num = 1

for i in range(100):
  for j in range(2,10):
    if i**j <= x:
      num = max(num,i**j)

print(num)
import math
X = int(input())
bp = {b**p for b in range(1,int(math.sqrt(X))+1) for p in range(2,10) if b**p <= X}
print(max(bp))
x = int(input())

ans = 0
for i in range(1, x + 1):
  for j in range(2, x + 2):
    if i ** j <= x:
      ans = max(ans, i ** j)
    else:
      break
print(ans)
import math
x = int(input())
maximum = 1

for i in range(2, math.ceil(x**0.5)):
    for j in range(1, 12):
        if(maximum < i**j <= x):
            maximum = i**j
            
print(maximum)
x = int(input())
ans = 0
if x == 1:
    print(1)
    exit(0)
for b in range(1,x+1):
    for p in range(2,x):
        if b**p <=x:
            ans = max(ans,b**p)
        else:break

        
    
print(ans)
x = int(input())
ans = 0


for i in range(1, 100):
    if i**2 > x:
        ans = (i - 1)**2
        break

for i in range(1, 100):
    if i**3 > x:
        ans = max(ans, (i - 1)**3)
        break

for i in range(1, 100):
    if i**5 > x:
        ans = max(ans, (i - 1)**5)
        break

for i in range(1, 100):
    if i**7 > x:
        ans = max(ans, (i - 1)**7)
        break

print(ans)
ls = [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,1020]
X = int(input())
for i in range(len(ls)):
  if X<ls[i]:
    print(ls[i-1])
    break
x = int(input())
ex = [0 for i in range(1001)]
ex[1] = 1

for i in range(2, 1001):
  tmp = i * i
  while tmp <= 1000:
    ex[tmp] = 1
    tmp *= i
  
for i in range(x, 0, -1):
  if ex[i] == 1:
    print(i)
    break
X = int(input())
ans = 1
for i in range(2, X + 1):
    for j in range(2, X + 1):
        a = i ** j
        if a > X:
            break
        elif a > ans:
            ans = a
print(ans)
def main():
    X = int(input())

    ans = [1]
    for b in range(1, 32):
        for p in range(2, 10):
            if b ** p <= X:
                ans.append(b**p)
    ans.sort()
    print(ans[-1])


if __name__ == "__main__":
    main()
X = int(input())

maxi = 0

if X < 4:
    print(1)
    exit()

for i in range(1, X+1):
    for j in range(2, X+1):
        if i**j <= X and i**j >= maxi:
            maxi = i**j
        if i**j > X:
            break

print(maxi)
X = int(input())
ans = 1
i = 2
while i * i <= X:
  a = i
  while a * i <= X:
    a *= i
  ans = max(ans, a)
  i += 1
print(ans)
import math
x=int(input())
lis=[1]
for i in range(2,math.ceil(math.sqrt(x))):
  n=i*i
  while n<=x:
    lis.append(n)
    n*=i

print(max(lis))
x = int(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)
import sys
x = int(input())

ans = 0
for i in reversed(range(1, x + 1)):
    for j in reversed(range(2, x+1)):
        if i % j != 0:
            continue
        w = i // j
        p = 1
        while w % j == 0:
            w //= j
            p += 1
        if w == 1 and p >= 2:
            print(i)
            sys.exit()
print(1)
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

x = ni()
ans = 0
for i in range(100):
    for j in range(2,11):
        p = i**j
        if p <= x:
            ans = max(ans, p)
        else:
            continue

print(ans)
x=int(input())
ans=1
for i in range(34,1,-1):
    cur=i
    while cur<=x:
        cur*=i
        if cur<=x:
            ans=max(ans,cur)
print(ans)
import math
X=int(input())

A=[1]
for b in range(2,32):
  for p in range(2,10):
    if b**p>X:
      break
    elif b**p not in A:
      A.append(b**p)
print(max(A))
X = int(input())

max_num = 1

for bosuu in range(1, 50):
    for sisuu in range(2, 11):
        num = bosuu ** sisuu
        
        if (num <= X):
            max_num = max(max_num, num)
        else:
            break

print(max_num)
X=int(input())
ans=1
for i in range(1,X):
    for j in  range(2,10):
        if i**j<=X:
            ans=max(ans,i**j) 
print(ans)
X=int(input())
if X==1:
    print(1)
    exit()
ans=1
for i in range(2,11):
    for j in range(1001):
        if j**i<=X:
            if ans<j**i:
                ans=j**i
print(ans)
def myAnswer(X:int) -> int:
   numbers = [i for i in range(2,X+1)]
   ans = 1
   for p in numbers:
      i = 2
      while True:
         if(p**i <= X):
            ans = max(p**i,ans)
            i += 1
         else:
            break
   return ans


def modelAnswer():
   tmp=1
def main():
   X = int(input())
   print(myAnswer(X))
if __name__ == '__main__':
   main()
N = int(input())
ans = 0
if N <= 3:
    print(N)
    exit(0)
for i in range(2, 33):
    for j in range(2, 11):
        t = i ** j
        if t <= N:
            ans = max(ans, t)
print(ans)
from math import sqrt
x = int(input())
l = []
for i in range(1, x + 1):
    for j in range(1, int(sqrt(i)) +1):
        for k in range(2, 10):
            if j ** k == i:
                l.append(i)
print(max(l))
X = int(input())

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

print(ans)
X=int(input())
ans = 0
for i in range(1,101):
    for j in range(2,11):
        if ans < pow(i,j) <=X:
            ans = pow(i,j)
print(ans)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import bisect


def main():
    X = int(input())
    result = []
    for i in range(1, 33):
        result += [i ** j for j in range(2, 10)]
    result.sort()
    index = bisect.bisect_right(result, X)

    print(result[index - 1])


if __name__ == "__main__":
    main()
X = int(input())
A = [1]
for i in range(2, 40):
    j = 2
    while(1):
        if i**j > X: break
        A.append(i**j)
        j += 1
print(max(A))
x = int(input())
ans = 1
for i in range(2, x+1):
    a = i*i # a^2
    while a <= x:
        ans = max(ans, a)
        a *= i # a^{2<n}
print(ans)
X = int(input())

ans = []
for i in range(1, 1000):
    for j in range(2, 11):
        if i**j > X:
            continue
        ans.append(i**j)
print(max(ans))
x = int(input())
ans = 1
for i in range(1,x):
    for j in range(2,50):
        if i**j<=x:
            ans = max(ans,i**j)
        else:
            break
    if i**2>x:
        break
print(ans)
from math import *

x = int(input())

lst1 = list(range(2, int(sqrt(1000)) + 1))
lst2 = [1, 1000]

for n in lst1:
   i = 2
   while n ** i < 1000:
      lst2.append(n ** i)
      i += 1

lst2 = list(set(lst2))
lst2.sort()

for i in range(len(lst2)):
   if x < lst2[i]:
      print(lst2[i - 1])
      exit()

print(lst2[-1])
import sys
import math
import bisect

def main():
    A = []
    for i in range(1, 33):
        for j in range(2, 11):
            val = i ** j
            if val <= 1200:
                A.append(val)
            else:
                break
    A.sort()
    x = int(input())
    p = bisect.bisect_right(A, x)
    print(A[p-1])


if __name__ == "__main__":
    main()
import math
x=int(input())
ans=0
for i in range(1,32):
  for j in range(2,10):
    if i**j<=x:
      ans=max(ans,i**j)
print(ans)
x = int(input())
ans = 1
for i in range(1, x + 1):
  for j in range(2, 32):
    for k in range(2 , 10):
      if i == j ** k:
        ans = i
print(ans)
x=int(input())
ans=1
for i in range(2,10):
    for j in range(1,33):
        if j**i>ans and j**i<=x:
            ans=j**i
print(ans)
import math

x = int(input())
ans = [1]
s = int(math.sqrt(x))
if s >= 2:
    for i in range(2,s+1):
        temp = i
        while True:
            temp *= i
            if temp <= x:
                ans.append(temp)
            else:
                break

print(max(ans))
x = int(input())

if x == 1:
    print("1")
    exit(0)

ans = 1
for b in range(2, 1000 + 1):
    for p in range(2, 10+1):
        bp = b**p
        if bp <= x:
            ans = max(ans, bp)

print(ans)
x = int(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)
X=int(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)
X = int(input())
count = [1]
for x in range (2,50):
    for y in range (2,10):
        if x ** y <= X:
            count.append(x ** y)
print(max(count))
# coding:utf-8
import math
x = int(input())
num = math.floor(x ** 0.5)
ans = 1

for i in range(1, num + 1):
    for j in range(2, x):
        if i ** j > x:
            break
        if i ** j > ans:
            ans = i ** j

print(ans)
x = int(input())
ans = 1000000
for b in range(1,32):
    for p in range(2,10):
        if x-b**p < 0:
            continue
        ans = min(ans,abs(x-(b**p)))
print(x-ans)
X = int(input())

max_num = 1
for i in range(1, X + 1):
    for j in range(2, X + 1):
        num = i ** j
        if num <= X:
            if num > max_num:
                max_num = num
        else:
            break

print(max_num)
x = int(input())

ans = 1
for i in range(2, int(x**(1/2)//1+1)):
    v = 1
    while v*i <= x:
        v *= i
    ans = max(ans, v)
print(ans)
X=int(input())
a=1
b=2
p=2
while b<=int(X**.5):
    if b**p<=X:
        a=max(a,b**p)
        p+=1
    else:
        b+=1
        p=2
print(a)
x=int(input())
ans=1
for num in range(2,x+1):
    k=x
    cnt=0
    while k>=num:
        k//=num
        cnt+=1
    if cnt>=2:
        ans=max(ans,pow(num,cnt))
print(ans)
X = int(input())

if X == 1:
    print(1)
    exit()

b = 2
ans = 0

while b ** 2 <= X:
    p = 2
    while b ** p <= X:
        p += 1
    ans = max(ans, b ** (p-1))
    b += 1

print(ans)
X=int(input())

X_=int(X**0.5)+1

ans=1
for i in range(2,X+1):
    for j in range(2,X_):
        bi=i
        while True:
            if bi%j!=0:
                break
            bi//=j
            if bi==1:
                ans=i

print(ans)
x = int(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)))
import sys
import time
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    X = int(readline())
    r = int(X**0.5)
    ans = 1
    for i in range(r,0,-1):
        tmp = i
        if i ==1:
            break
        while tmp<=X:
            ans = max(ans,tmp)
            tmp *=i
    print(ans)




if __name__ == '__main__':
    main()
x = int(input())
if x < 4:
    print(1)
    exit()
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)
import sys
input = sys.stdin.readline
def main():
    X = int(input())
    ans = 0
    for i in range(1,X+1):
        for j in range(2,X+2):
            if i**j <= X:
                ans = max(ans, i**j)
            else:
                break
    print(ans)

if __name__ == '__main__':
    main()
X = int(input())

ans = 1
for b in range(2, 40):
    p = 2
    while True:
        val = b ** p
        if val > X:
            break
        ans = max(ans, val)
        p += 1

print(ans)
import math
X=int(input())
max_num = 0
for i in range(2,10):
  tei = math.floor(X**(1/i))
  if (tei+1)**i <= X: tei = tei + 1
  if max_num < tei**i:
    max_num = tei**i
print(max_num)
X = int(input())
l=[]
for i in range(1,101):
    for j in range(2,11):
        if i**j > 1000:
            break
        else:
            l.append(i**j)
for k in range(X):
    if X - k in l:
        print(X-k)
        break
X=int(input())
s=set(i**j for i in range(40) for j in range(2,10) if i**j<=X)
print(max(s))
x = int(input())
c=1
for b in range(1,x):
    for p in range(2,x):
        if b**p<=x:c=max(c,b**p)
        else:break
print(c)
import math
N = int(input())
max = 0
for i in range(int(math.sqrt(N)+1)):
	for j in range(10):
		if(i**j>max and i**j <=N):
			max = i**j
print(max)
import sys
input = sys.stdin.readline
X = int(input())
x = int(X ** (1/2))
ans = 1
for i in range(2,x+1) :
    a = 1
    e = 0
    while a == 1 :
        k = i ** e
        if k > X :
            k = i ** (e-1)
            a = 0
            break
        e+=1
    ans = max(ans,k)
print(ans)
x = int(input())
ma = 0
for i in range(1,100):
    for j in range(2,100):
        if i**j <= x:
            ma = max(ma,i**j)
print(ma)
x = int(input())
count = 1
for i in range(1,x+1):
    for n in range(2,10):
        if i**n <= x:
            count = max(i**n,count)
print(count)
X = int(input())
List = [1]
a =0
for i in range(2,35):
  for j in range(2,11):
    a = i**j
    if a <= 1000:
      List.append(i**j)
    else:
      break
List.sort()
k = 0
for i in range(len(List)):
  if List[i] > X:
    k = i-1
    break
  elif List[i] == X:
    k = i
    break
print(List[k])
x=int(input())
r=int(x**0.5)
a=1
for b in range(r+1):
    for p in range(10):
        if b**p <=x :
            a=max(a,b**p)
        else:
            break
print(a)
x = int(input())
ans = 1
for i in range(2, x + 1):
  for j in range(2, 20):
    if i**j > x:
      break
    ans = max(ans, i**j)
print(ans)