X = int(eval(input()))

if X==1:

    print((1))

else:

    cmax = 1

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

        k = 2

        while i**k<=X:

            cmax = max(cmax,i**k)

            k += 1

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

n = 1

if X<=3:

    print((1))

elif X==4:

    print((4))

else:

    n = 4

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

        b = i

        k = 1

        while b**k<=X:

            k += 1

        k -= 1

        if k>=2:

            n = max(n,b**k)

    print(n)
X = int(eval(input()))
if X == 1:
    print((1))
else:
    cmax = 1
    for i in range(2, int(X**0.5) + 1):
        k = 2
        while i**k <= X:
            cmax = max(cmax, i**k)
            k += 1
    print(cmax)

X = int(eval(input()))
n = 1
if X <= 3:
    print((1))
elif X == 4:
    print((4))
else:
    n = 4
    for i in range(2, int(X**0.5) + 1):
        b = i
        k = 1
        while b**k <= X:
            k += 1
        k -= 1
        if k >= 2:
            n = max(n, b**k)
    print(n)

-if X == 1: +n = 1 +if X <= 3: +elif X == 4: +    print((4)) -    cmax = 1 +    n = 4 -        k = 2 -        while i**k <= X: -            cmax = max(cmax, i**k) +        b = i +        k = 1 +        while b**k <= X: -    print(cmax) +        k -= 1 +        if k >= 2: +            n = max(n, b**k) +    print(n)