x = int(eval(input()))

c = 1



for b in range(1,x):

  for q in range(2,x):

    if b**q <=x:

      c = max(c,b**q)

    else:

      break

print(c)
x = int(eval(input()))

c = []



for b in range(1,x+1):

  for q in range(2,x+2):

    a = b**q

    if a <=x:

      c.append(a)

    else:

      break



C = set(c)

print((max(C)))

x = int(eval(input()))
c = 1
for b in range(1, x):
    for q in range(2, x):
        if b**q <= x:
            c = max(c, b**q)
        else:
            break
print(c)

x = int(eval(input()))
c = []
for b in range(1, x + 1):
    for q in range(2, x + 2):
        a = b**q
        if a <= x:
            c.append(a)
        else:
            break
C = set(c)
print((max(C)))

-c = 1 -for b in range(1, x): -    for q in range(2, x): -        if b**q <= x: -            c = max(c, b**q) +c = [] +for b in range(1, x + 1): +    for q in range(2, x + 2): +        a = b**q +        if a <= x: +            c.append(a) -print(c) +C = set(c) +print((max(C)))