peterverebics/CodeNet_Python_118 huggingface dataset:
import math
x = int(input())
s = math.floor(math.sqrt(x))
if x == 1:
  print(1)
  exit()

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

ans = 0
for i in range(2,s+1):
  ans = max(ans, i ** l(i,x))
  
print(ans)
x = int(input())
res = 1
for b in range(2, int(pow(1000, 1/2))+1):
    flag = True
    p = 2
    while b**p <= x and flag:
        p += 1
        flag = False
    if not flag: res = max(res, b**(p-1))
print(res)
import math
n = int(input())
ans = 0

for i in range(1,math.ceil(math.sqrt(n))):
    for j in range(2,11):
        if i ** j > n and j > 2:
            ans = max(ans,i ** (j-1))
            break

print(ans)
N = int(input())
for i in range(1,N+1)[::-1]:
    for j in range(2,35):
        if i%j == 0:
            if (i//j)%j == 0:
                print(i)
                break
    else:
        continue
    break
n = int(input())
import math as m
if n < 4:
  print(1)
  exit(0)
  
perfect = 1
for i in range(2,int(n**0.5)+1):
  x = i**(int(m.log(n,i)))
  perfect = max(perfect,x)
  if perfect == n:
    break

print(int(perfect))
X = int(input())

x = 0

if X == 1:
  print(X)
  
else:
  for i in range(2,int(X ** 0.5) + 1):
    n = 1
    a = i
    while n < X :
      n *= a
    if n // a > x:
      x = (n // a)
  
  print(x)
X = int(input())
fact = [1]
for i in range(2, 40):
  p = i
  while(p <= 1000):
    fact.append(p)
    p = p*i
fact.sort()
ans = 0
for n in fact:
  if(n <= X):
    ans = n
  else:
    print(ans)
    break
import math
x = int(input())
s = math.floor(math.sqrt(x))
if x == 1:
  print(1)
  exit()
if x == 2 or 3:
  print(2)
  exit()
  
def l(k,p):
  return(int(math.floor(math.log(p)/math.log(k))))

ans = 0
for i in range(2,s+1):
  ans = max(ans, i ** l(i,x))
  
print(ans)
X=int(input())

max=X//2+1
r=0

for b in range(1,X):
  for p in range(2,X):
    r=b**p
    if r>=X:
      r=0
      break
    elif r>=max:
      max=r
      #print(b,p,r)
  if r>=X:
    break  

print(max)
import math
x = int(input())
for i in range(x,0,-1):
    if math.sqrt(i).is_integer() == True:
        print(i)
        break
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

x = int(input())
li = [1]
b = 2
while True:
    if b == 100:
        break
    p = 2
    while True:
        d = b**p
        if d>=x:
            break
        li.append(d)
        p += 1
    b+=1
li.sort()
print(li[-1])
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    x = int(input())
    ans = 1
    for i in range(1, x + 1):
        if i * i <= x:
            ans = i * i
    print(ans)


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

a aa c ca c a b a ab a b c

"""
x = int(input())
ans = 0
if x == 1 or x == 2 or x == 3:
  print(1)
  exit()
  
for i in range(2,33):
  for k in range(2,10):
    if k == 2 and i**k > x:
      print(ans)
      exit()
    elif i**k < x:
      ans = max(i**k,ans)
X=int(input())
if X==1:
  max=1
if X==2:
  max=1
else:
  for i in range(1, X):
    for j in range(2, X):
      if i**j<=X:
        max=i**j
print(max)
x=int(input())
ma=1
for i in range(2,x):
  ex=i**3
  for j in range(x):
    if ex>x:
      if ex>ma and ex//i<=x:
        ma=ex//i
      break
    ex=ex*i
print(ma)
x = int(input())
for i in range(1, x+1):
    v = i ** (1/2)
    if v.is_integer():
        ans = int(i)

print(ans)
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

x = int(input())
i = 1
while True:
    a = i**2
    if x<a:
        break
    i+=1
print((i-1)**2)
x = int(input())
ans = int(x ** 0.5)
print(ans **2)
x=int(input())
a=[1]
for i in range(1,300):
  for j in range(2,300):
    if i**j<=x:
      a.append(i**j)
print(a[-1])
x = int(input())
ans = 1
for i in range(1,x+1):
  for j in range(2,11):
    if i**j < x:
      ans = max(ans,i**j)
    else:
      break
print(ans)
n=int(input())
if n==1:
  print(1)
  exit()
i,j=1,2
m=i**j
while(i**j<n):
  i=1
  while(True):
    f=(i+1)**j<=n
    if f==True:
      i+=1
    else:
      break
  m=max(m,i**j)
  j+=1
print(m)
x = int(input())
min = 1000
for i in range(1,1000):
	for j in range(2,40):
		if x-i**j < min and 0 < x-i**j:
			min = x-i**j
print(x-min)
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):
  if i**2 <= x:
    num = i**2

print(num)
x=int(input())
l=[1]
for i in range(2,32):
  k=2
  while i**k<1000:
    l.append(i**k)
    k+=1
l=sorted(l)
for i in range(len(l)-1):
  if l[i]<=x<l[i+1]:
    print(l[i])
    exit()
print(961)
import numpy as np

N = int(input())

expo = []
for i in range(1,10):
    if i == 1:
        expo.append(i)
    else:
        for j in range(2,1000):
            tmp = i**j
            if tmp > N:
                break
            expo.append(tmp)
expo.sort()

expo = np.array(expo)

print(max(expo[expo<=N]))
import math
X=int(input())
max_num = 0
for i in range(1,9):
  tei = math.floor(X**(1/i))
  if max_num < tei**i:
    max_num = tei**i
print(max_num)
x = int(input())
while x >= 1:
    if x**(1 / 2) == int(x**(1 / 2)):
        print(x)
        break
    else:
        x -= 1
N = int(input())
li = []
for i in range(1,100):
    for j in range(2,50):
        if i**j<=1000:
            li.append(i**j)
li.sort()
ans = 1
for k in range(len(li)):
    if (li[k]>N)&(li[k-1]<N):
        ans = li[k-1]
print(ans)
X=int(input())
d=[1]
for i in range(2,1001):
  p=2
  while i**p<X:
    d.append(i**p)
    p+=1
  d=list(set(d))
print(max(d))
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):
    p = i**2
    if p <= x:
        ans = p
    else:
        print(ans)
        break
x=int(input())
ma=1
for i in range(x):
  ex=1
  for j in range(x):
    ex=ex*i
    if ex>x:
      if ex//i>ma:
        ma=ex//i
      break
print(ma)
n=int(input())
ans=1
for b in range(2,100):
    tmp=1
    for p in range(2,10):
        tmp*=b
        if tmp<=n :
            ans=max(ans,tmp)
print(ans)
x = int(input())
ans = 1
for i in range(100):
    for j in range(100):
        if x < i**j: break
        else: ans = max(ans, i**j)
print(ans)
x = int(input())

a = []

for i in range(x):
    if i**2 <= x:
        b=i*i
        a.append(b)

print(max(max(a),1))
X = int(input())
n = 0
while n**2 <= X:
    ans = n**2
    n+=1
print(ans)
x=int(input())
a=[1]
for i in range(1,32):
  for j in range(1,32):
    if i**j<=x:
      a.append(i**j)
print(max(a))
import math
X = int(input())
max_exp = -1
for i in range(1, X+1):
    tmp = math.sqrt(i)
    if tmp.is_integer() and i > max_exp:
        max_exp = max(max_exp, i)
    if i == 1000:
        max_exp = max(1000, max_exp)
print(int(max_exp))
# coding:utf-8
import math
x = int(input())
num = math.floor(x ** 0.5)
# print(num)

print(num ** 2)
import math
x = int(input())
res = int(math.sqrt(x))
print(res * res)
X = int(input())
M = 0
for i in range(1, X):
    for p in range(2, 10):
        if M < i ** p < X:
            M = i ** p
        else:
            break

print(M)
x = int(input())
ans = 1
for i in range(2, int(x**0.5)+1):
  j = 0
  while i**j < x:
    ans = max(i**j, ans)
    j += 1

print(ans)
x=int(input())
ans=0
for b in range(2,1000):
    for p in range(2,10):
        temp=b**p
        if temp <= x:
            ans=max(temp,ans)

print(ans)
x = int(input())
  
for i in range(x, 0, -1):
  ans = i
  div = []
  for j in range(2,int(x**0.5)+2):
    count = 0
    if i%j ==0:
      while i%j==0:
        i //= j
        count += 1
      div.append(count)
  if i != 1:
    div.append(1)
  if len(div) == 1 and div[0] > 1:
    print(ans)
    break
else:
  print(1)
x=int(input())
ans=0
for i in range(31):
  if x>=(i+1)**2:
    ans=(i+1)**2
  else:
    print(ans)
    break
#!/usr/bin/env python3
import math

x = int(input())
ans = 1

n = 2

while n < 5:
    c = 1
    while x >= c**n:
        ans = max(ans,c**n)
        c += 1
    n += 1
print(ans)
from math import sqrt
x = int(input())
cnt = 0
l = []
for i in range(1, x + 1):
    for j in range(1, int(sqrt(i)) +1):
        if j ** 2 == i:
            l.append(i)
print(max(l))
def primes(x):
    res = []
    a = 2
    while x >= a*a:
        while x % a == 0:
            x //= a
            res.append(a)
        a += 1
    if x != 1:
        res.append(x)
    return res

x = int(input())
if x < 4:
    print(1)
else:
    for i in reversed(range(4,x+1)):
        p = primes(i)
        if len(p) > 1 and len(set(p)) == 1:
            print(i)
            break
def expone():
    N = int(input())

    while N > 0:
        i = 1
        while i <= N:
            if i ** 2 == N:
                print(N)
                return 0
            i += 1
        N -= 1

if __name__ == "__main__":
    expone()
X=int(input())
import math
ans=[math.pow(math.floor(math.pow(X,1/i)),i) if math.pow(math.floor(math.pow(X,1/i)),i)<=X else 0 for i in range(2,10)]
print(int(max(ans)))
import math
X = int(input())
def expo(x):
    ans = 1
    for i in range(1,x+1):
        if math.sqrt(i).is_integer() == True:
            ans = i
    return ans
print(expo(X))
X = int(input())
for i in range(X,0,-1):
    if i**2 <= X:
        print(i**2)
        exit()
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(40) if is_prime(i)]
num = []

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

if X == 1:
    print(1)
else:
    print(max(num))
n=int(input())
i=1
while((i+1)**2<=n):
   i+=1
print(i**2)
from math import sqrt
X=int(input())
print(int(sqrt(X))**2)
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
num = []
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

x = k()

for i in range(x+1):
    if i**2<=x:
        ans = i

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

for i in range(40,0,-1):
    for j in range(40,1,-1):
        if i**j<=x:
            print(i**j)
            exit()
from math import sqrt
X = int(input())

def f():
    for x in range(X, 0, -1):
        for p in range(X, 1, -1):
            if x ** (1 / p) == int(x ** (1 / p)):
                return x
    return 1

print(f())
x = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字

ans = 0
for i in range(1000 + 1):
    if i ** 2 <= x:
        ans = max(ans, i ** 2)
print(ans)
X = int(input())

X_half = X // 2
max_ans = 1
tmp_max = 0

for i in range(1,X_half+1):
    for j in range(2,X_half+1):
        tmp = i ** j
        if tmp<=X:
            tmp_max = tmp
            break
    max_ans = max(max_ans, tmp_max)

print(max_ans)
# -*- coding: utf-8 -*-
x = int(input())

ans = 1
for i in range(x):
    for j in range(int(pow(x, 0.5)) + 1):
        for k in range(int(pow(x, 0.5)) + 1):
            if i == pow(j, k) and ans < i:
                ans = i
print(ans)
import sys
X = int(input())
L = []
for i in range(1,32):
  for j in range(2,10):
    if X <= i**j:
      L.append(i**(j-1))
      break
print(max(L))
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
print(max(L))
import math

X = int(input())
if X < 4:
    print(1)
    exit()
for x in range(X, 0, -1):
    for y in range(2, x, 1):
        log = math.log(x, y)
        div, mod = divmod(log, 1)
        if mod == 0:
            print(x)
            exit()
y = 0
x = int(input())
for i in range(1001):
    x2 = i**2
    if x2 <= x:
        y = x2
print(y)
X=int(input())
numbers=[]
for a in range(1,1001):
    if (a**0.5).is_integer():
        numbers.append(a)
    elif (a**(1/3)).is_integer():
        numbers.append(a)
    elif (a**(0.2)).is_integer():
        numbers.append(a)
    elif (a**(1/7)).is_integer():
        numbers.append(a)
answer=[a for a in numbers if a<=X]
print(round(max(answer)))
X=int(input())
if X==1:
    print(1)
    exit()
N=[1]
i=2
while True:
    N.append(i**2)
    i+=1
    if N[-1]>1000:
        break
N.append(X)
N.sort()
if N.count(X)==2:
    print(N[N.index(X)])
else:
    print(N[N.index(X)-1])
x = int(input())
for _ in range(1000):
    if all(x**(1/i)!=int(x**(1/i)) for i in range(2, 100)):
        x -= 1
    else :
        print(x)
        break
import math
x = int(input())
ans = 1
n = math.floor(math.sqrt(x))
for i in range(2,n+1):
    a = i
    while a < x:
        if a <= x: ans = max(ans, a)
        a *= a
print(ans)
N = int(input())
for i in range(N):
	if(i*i > N):
		print((i-1)*(i-1))
		break
x = int(input())
y = int(x**0.5)
if (y+1)**2 <= x:
    y += 1
print(y**2)
X = int(input())
cmax = 0
for i in range(2,int(X**0.5)+1):
    k = 2
    while i**k<=X:
        k += 1
    cmax = max(cmax,i**(k-1))
print(cmax)
x=int(input())
l=[]
for i in range(1,x+1):
    for j in range(1,x+1):
        if j*j==i:
            l.append(j*j)
        if j*j*j==i:
            l.append(j*j*j)
        if j*j*j*j==i:
            l.append(j*j*j*j)
print(max(l))
import math
x = int(input())
b = 1
for i in range(2, int(math.sqrt(x)) + 1):
    p = int(math.log(x, i))
    b = max(b, i ** p)
print(b)
X = int(input())
A = []
for i in range(2,10):
    for j in range(1, int(X**(1/i))+1):
        A.append(j**i)
print(X-min([abs(a - X) for a in A]))
X = int(input())

def han(n, k):
  if int(n**(1/k)) == n**(1/k):
    return True
  else:
    return False
  
while 1:
  if han(X, 2) or han(X, 3) or han(X, 5) or han(X, 7) or han(X, 4) or han(X, 6) or han(X, 8) or han(X, 9) or han(X, 10) or han(X, 11) or han(X, 12) or han(X, 13):
    print(X)
    break
  X -= 1
import math 
X=int(input())
max_num=0
for i in range(2,11):
  tei=math.floor(X**(1/i))
  if max_num<tei**i:
    max_num=tei**i
print(max_num)
import math
x = int(input())
ans = 1 # 1^b
n = math.floor(math.sqrt(x))
for i in range(2,n+1):
    a = i# a^1
    while a < x:
        a *= a # a^{<=2}
        if a <= x: ans = max(ans, a)
print(ans)
p = []
p.extend([i ** 2 for i in range(int(1000**(1/2)) + 1)])
p.extend([i ** 3 for i in range(int(1000**(1/3)) + 1)])
p.extend([i ** 5 for i in range(int(1000**(1/5)) + 1)])
p.extend([i ** 7 for i in range(int(1000**(1/7)) + 1)])
p.sort()
p.append(1000)
print(p)
N = int(input())

for i in range(len(p) - 1):
  if p[i] <= N < p[i + 1]:
    print(p[i])
def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
prime = []
for i in range(1,1001):
  if is_prime(i):
    prime.append(i)
pow = [1]
for p in prime:
  i=1
  while p**i<=1000:
    pow.append(p**i)
    i += 1
X = int(input())
x = X
while x>0:
  if x in pow:
    ans = x
    break
  x -= 1
print(ans)
a=int(input())
result=[]
for i in range(a+1):
  if i**2<=a:
    result.append(i**2)
print(max(result))
import math
x = int(input())
print(math.floor(x**0.5) ** 2)
n = int(input())
import math as m
if n < 4:
  print(1)
  exit(0)
  
perfect = 1
for i in range(2,int(n**0.5)+1):
  x = i**(int(m.log(n,i)))
  perfect = max(perfect,x)
  if perfect == n:
    break

print(perfect)
x = int(input())

res = 0
for i in range(1, x):
  for j in range(2, x):
    cand = i ** j
    if x >= cand:
      if cand > res:
        res = cand
print(res)
import numpy as np
X = int(input())
while X > 0:
    a = np.sqrt(X)
    if a.is_integer() == True:
        break
    else:
        X -= 1
print(X)
X=int(input())
a=2
ans=1
if X==1:
    print(1)
    exit()
else:
    while a<1001:
        for i in range(2,1001):
            if a**i<=X:
                ans=a**i
            else:
                break
        a+=1
print(ans)
# from sys import stdin
import math

X = int(input())

# for i in range(33):
ans = 0
for i in range(int(math.sqrt(X))+1):
    for x in range(11):
        print(i,x)
        if i**x < X and i**x > ans:
            ans = i**x
print(ans)
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    for i in range(1,33):
        if i**2>x:
            print((i-1)**2)
            break
resolve()
import math
X = int(input())
max_exp = -1
for i in range(1, X+1):
    tmp = math.sqrt(i)
    if tmp.is_integer():
        max_exp = max(max_exp, i)
print(int(max_exp))
# -*- coding: utf-8 -*-

#----------
X = int(input().strip())
#----------
candidate=set()
max_num = int( 1000**(1/2) )
for i in range( max_num + 1 ):
    for j in range( max_num + 1 ):
        calc = i**j
        if calc <= 1000:
            candidate.add(i**j)

ans=0
for i in candidate:
  if i <= X and ans < i:
    ans = i

print(ans)
from math import sqrt
X = int(input())

for x in reversed(range(1, X+1)):
  flag = False
  for i in range(2,11):
    t = x**(1/i)
    if t.is_integer():
      print(x)
      flag = True
      break
  if flag:
    break
x=int(input())
data=[1,2,3,5,7,11,13,17,19,23,29,31]
ans=0
for i in data:
  for j in range(2,10):
    if i**j<=x:
      ans=max(ans,i**j)
    else:
      break
print(ans)
x = int(input())
c = 1
for n in range(1, x):
    for p in range(2, x):
        print(n, n ** p)
        if n ** p <= x:
            c = max(n ** p, c)
        else:
            break
print(c)
x=int(input())
i=0
while True:
    if (i+1)**2>x:
        break
    i+=1
print(i**2)
import math
x = int(input())

sq_x = int(x ** 0.5)

ans = 0
for i in range(2, sq_x + 1):
    p = int(math.log(x, i))
    ans = max(ans, i ** p)
print(ans)
import numpy as np
x = int(input())
for i in range(x, -1, -1):
    if np.sqrt(i) % 1 == 0:
        print(i)
        break
import math 
X=int(input())
max_num=0
c=[]
for i in range(2,11):
  tei=math.floor(X**(1/i))
  c.append(tei**i)
print(max(c))
N = int(input())
li = []
for i in range(1,100):
    for j in range(2,10):
        if i**j<=1000:
            li.append(i**j)
list(set(li)).sort()
ans = 1
for k in range(len(li)):
    if (li[k-1]<N)&(li[k]>=N):
        ans = li[k-1]
print(ans)
x = int(input())
ans = 0
if x == 1 or x == 2 or x == 3:
  print(1)
  exit()
  
for i in range(2,33):
  for k in range(2,9):
    if k == 2 and i**k > x:
      print(ans)
      exit()
    elif i**k < x:
      ans = max(i**k,ans)
# B. Exponential
# https://atcoder.jp/contests/abc097/tasks/abc097_b

x = int(input())

ans = 1
for b in range(2, int(x ** .5) + 2):
  p = 2
  while b ** p <= x:
    ans = b ** p
    p += 1

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

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

lst = []
for i in range(100):
    for j in range(10):
        if i**j >= 1000:
            break
        else:
            lst.append(i**j)

for k in range(X):
    if X - k in lst:
        print(X-k)
        break
X=int(input())
ans=1
for i in range(X):
  for j in range(X):
    if i**j<=X:
      ans=i**j
print(ans)
import math
x = int(input())

for i in reversed(range(x)):
    if round(math.sqrt(i))**2 == i:
        print(i)
        break
x = int(input())
ans = 0
for b in range(2, 33):
    for p in range(2, 12):
        if b**p<=x:
            ans = max(ans, b**p)
print(ans)
x = int(input())
ans = 1 # 1^b = 1
for i in range(x+1,1,-1): # [x,2]
    a = i # a^1
    while a < x:
        a *= i # a^b,(b>=2)
        if a <= x:
            print(a)
            exit()
print(ans)
p = []
p.extend([i ** 2 for i in range(int(1000**(1/2)) + 1)])
p.extend([i ** 3 for i in range(int(1000**(1/3)) + 1)])
p.extend([i ** 5 for i in range(int(1000**(1/5)) + 1)])
p.extend([i ** 7 for i in range(int(1000**(1/7)) + 1)])
p.sort()
p.append(1001)
 
N = int(input())

for j in range(len(p) - 1):
  if p[j] <= N < p[j + 1]:
    print(p[j])
X = int(input())
nums = set()
for b in range(1, 40):
    p = 2
    if b**p <= 1000:
        nums.add(b**p)
        p += 1
    else:
        continue
ans = -1
for num in nums:
    if num <= X:
        ans = max(ans, num)
print(ans)
x = int(input())
pr = [1]
for i in range(2,32):
    for j in range(2,11):
        if (i**j < 1000)&(i**j not in pr):
            pr.append(i**j)
print(max([k for k in pr if k <= x]))
n = int(input())
a = n//2
while True:
  if a**2 <= n:
    print(a**2)
    break
  a -= 1
X = int(input())
Y = X
A = 0
while X % 2 == 0:
  A += 1
  X = X // 2
print(max(int(Y**0.5)**2,2**A))
import math


x = int(input())

ans = 0
for i in range(x, -1, -1):
    tmp = math.sqrt(i)
    if tmp == int(tmp):
        print(i)
        exit()
N = int(input())
li = []
for i in range(1,100):
    for j in range(2,10):
        if i**j<=1000:
            li.append(i**j)
li2 = list(set(li))
li2.sort()
ans = 1
for k in range(len(li2)):
    if (li2[k-1]<=N)&(li2[k]>N):
        ans = li2[k-1]
print(ans)
import math
x = int(input())
ans = 1
for i in range(1,int(math.sqrt(x)+2)):
  for j in range(2,10):
    if i ** j <= x:
      ans = i**j
    else:
      break
print(ans)
x=int(input())
a=[1]
for i in range(32):
  for j in range(32):
    if i**j<=x:
      a.append(i**j)
print(max(a))
x = int(input())
i = 1
a = 0
while (i)**2 <= x:
    for j in range(2, 11):
        if i**j > x:
            a = max(ans, a)
            break
        ans = i**j
    i += 1
print(ans)
# ABC097 B - Exponential

X = int(input())
j=1
S=[]
for i in range(X):
    for j in range(X):
        M = i**j
        if M > X:
            S.append(i**(j-1))
            break
        elif M == X:
            exit()
            
print(max(S))
import math

X = int(input())
n = math.floor(X**0.5)
print(n**2)
import math
x = int(input())

sq_x = int(x ** 0.5)
ans = 0
for i in range(2, sq_x + 1):
    t = i
    while t <= x:
        ans = max(ans, t)
        t *= i

print(ans)
a = int(input())
l = [] 

for i in range(100):
    for j in range(10):
        if i**j <= a:
            l.append(i**j)
print(max(l))
x = int(input())

l = []
for i in range(1,33):
    for y in range(2,33):
        if i ** y <= x:
            l.append(i**y)
        else:
            break
print(l[-1])
x = int(input())
ans = 1
while ans**2 <= x:
    ans+=1
print((ans-1)**2)
import math
x = int(input())
ans = 1
for i in range(1,x):
  for j in range(2,x):
    if i ** j <= x:
      ans = i**j
    else:
      break
print(ans)
x = int(input())

def solve(num):
    a = num
    result = []
    x = []
    for i in range(2, int(num**(1/2))+1):
        if num%i==0:
            c = 0
            while num%i==0:
                num //= i
                c += 1
            result.append(c)
    if num!=1:
        result.append(1)
    return all(i%2==0 for i in result)

for i in range(x, 0, -1):
    if solve(i):
        print(i)
        break
x = int(input())
done = [0]*(x+1)
ans = 1
tmp = 0
for i in range(2, x):
  tmp = i
  while tmp*i <= x:
    if not done[tmp*i]:ans+=1
    done[tmp*i]=1
    tmp*=i
print(ans)
x = int(input())
p2 = [i ** 2 for i in range(1, 32)]
p3 = [k ** 3 for k in range(1, 10)]
p2_3 = p2 + p3
l = list(set(p2_3))

if x in l:
    l.append(x)
    l.sort()
    print(l[l.index(x)])
else:
    l.append(x)
    l.sort()
    print(l[l.index(x)-1])
def expone():
    N = int(input())

    max_n = 1
    for i in range(2,N+1):
        for j in range(2,N+1):
            if i ** j <= N:
                max_n = i ** j
            if i ** j > N:
                break
    print(max_n)


if __name__ == "__main__":
    expone()