x = int(eval(input()))



ans = 0

tmp = 1

for i in range(1, int(x**0.5)+1):

    for j in range(2, x):

      tmp = pow(i, j)

      if tmp > x:

          tmp = pow(i, j-1)

          #print(tmp, i, j)

          break



    ans = max(tmp, ans)



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



ans = 0

for i in range(1, int(X**0.5)+1):

    for j in range(2, 1000):

        tmp = pow(i, j)

        if tmp > X:

            break

        ans = max(ans, tmp)



print(ans)
x = int(eval(input()))
ans = 0
tmp = 1
for i in range(1, int(x**0.5) + 1):
    for j in range(2, x):
        tmp = pow(i, j)
        if tmp > x:
            tmp = pow(i, j - 1)
            # print(tmp, i, j)
            break
    ans = max(tmp, ans)
print(ans)

X = int(eval(input()))
ans = 0
for i in range(1, int(X**0.5) + 1):
    for j in range(2, 1000):
        tmp = pow(i, j)
        if tmp > X:
            break
        ans = max(ans, tmp)
print(ans)

-x = int(eval(input())) +X = int(eval(input())) -tmp = 1 -for i in range(1, int(x**0.5) + 1): -    for j in range(2, x): +for i in range(1, int(X**0.5) + 1): +    for j in range(2, 1000): -        if tmp > x: -            tmp = pow(i, j - 1) -            # print(tmp, i, j) +        if tmp > X: -    ans = max(tmp, ans) +        ans = max(ans, tmp)