x = int(eval(input()))

if x == 1:

    print((1))

    exit()

l = []

l.append(1)

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

    j = 2

    while i**j <= x:

        l.append(i**j)

        j += 1

#print(l)

l.sort()

print((l[-1]))
x = int(eval(input()))

ans = [1]

for i in range(2, 1001):

    p = 2

    while i**p <= x:

        ans.append(i**p)

        p += 1

ans.sort(reverse=True)

#print(ans)

print((ans[0]))

x = int(eval(input()))
if x == 1:
    print((1))
    exit()
l = []
l.append(1)
for i in range(2, x + 1):
    j = 2
    while i**j <= x:
        l.append(i**j)
        j += 1
# print(l)
l.sort()
print((l[-1]))

x = int(eval(input()))
ans = [1]
for i in range(2, 1001):
    p = 2
    while i**p <= x:
        ans.append(i**p)
        p += 1
ans.sort(reverse=True)
# print(ans)
print((ans[0]))

-if x == 1: -    print((1)) -    exit() -l = [] -l.append(1) -for i in range(2, x + 1): -    j = 2 -    while i**j <= x: -        l.append(i**j) -        j += 1 -# print(l) -l.sort() -print((l[-1])) +ans = [1] +for i in range(2, 1001): +    p = 2 +    while i**p <= x: +        ans.append(i**p) +        p += 1 +ans.sort(reverse=True) +# print(ans) +print((ans[0]))