x=int(eval(input()))



for i in range(x,-1,-1):

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

    for j in range(11):

      if k**j>i:

        break

      if k**j==i:

        print(i)

        exit()
x=int(eval(input()))



ans=1

for i in range(1,x):

  for j in range(2,x):

    if i**j>x:

      break

    ans=max(ans,i**j)

print(ans)
x = int(eval(input()))
for i in range(x, -1, -1):
    for k in range(int(i**0.5) + 1):
        for j in range(11):
            if k**j > i:
                break
            if k**j == i:
                print(i)
                exit()

x = int(eval(input()))
ans = 1
for i in range(1, x):
    for j in range(2, x):
        if i**j > x:
            break
        ans = max(ans, i**j)
print(ans)

-for i in range(x, -1, -1): -    for k in range(int(i**0.5) + 1): -        for j in range(11): -            if k**j > i: -                break -            if k**j == i: -                print(i) -                exit() +ans = 1 +for i in range(1, x): +    for j in range(2, x): +        if i**j > x: +            break +        ans = max(ans, i**j) +print(ans)