import bisect,collections,copy,itertools,math,numpy,string

def I(): return int(eval(input()))

def S(): return eval(input())

def LI(): return list(map(int,input().split()))

def LS(): return list(input().split())

##################################################

X = I()

kouho = []

ans = 1

kouho.append(1)

for i in range(2,1000):

    j = 1

    while i**j<=1000:

        j += 1

        if i**j<=1000:

            kouho.append(i**j)

kouho.sort()

for x in kouho:

    if x<=X:

        ans = x

    else:

        break

print(ans)

x = int(eval(input()))

kouho = [1]

for i in range(2,32):

    j = 2

    while i**j<=x:

        kouho.append(i**j)

        j += 1

print((max(kouho)))

import bisect, collections, copy, itertools, math, numpy, string


def I():
    return int(eval(input()))


def S():
    return eval(input())


def LI():
    return list(map(int, input().split()))


def LS():
    return list(input().split())


##################################################
X = I()
kouho = []
ans = 1
kouho.append(1)
for i in range(2, 1000):
    j = 1
    while i**j <= 1000:
        j += 1
        if i**j <= 1000:
            kouho.append(i**j)
kouho.sort()
for x in kouho:
    if x <= X:
        ans = x
    else:
        break
print(ans)

x = int(eval(input()))
kouho = [1]
for i in range(2, 32):
    j = 2
    while i**j <= x:
        kouho.append(i**j)
        j += 1
print((max(kouho)))

-import bisect, collections, copy, itertools, math, numpy, string - - -def I(): -    return int(eval(input())) - - -def S(): -    return eval(input()) - - -def LI(): -    return list(map(int, input().split())) - - -def LS(): -    return list(input().split()) - - -################################################## -X = I() -kouho = [] -ans = 1 -kouho.append(1) -for i in range(2, 1000): -    j = 1 -    while i**j <= 1000: +x = int(eval(input())) +kouho = [1] +for i in range(2, 32): +    j = 2 +    while i**j <= x: +        kouho.append(i**j) -        if i**j <= 1000: -            kouho.append(i**j) -kouho.sort() -for x in kouho: -    if x <= X: -        ans = x -    else: -        break -print(ans) +print((max(kouho)))