x = int(eval(input()))

list_ = []



if x == 1:

    print((1))

else:

    b = 2

    while b**2 <= x:

        p = 2

        while b**p <= x:

            list_.append(b**p)

            p += 1

        b += 1

    print((max(list_)))
x = int(eval(input()))

ans = 1

if x == 1:

    print((1))

else:

    b = 2

    while b**2 <= x:

        p = 2

        while b**p <= x:

            ans = max(b**p, ans)

            p += 1

        b += 1

    print(ans)
x = int(eval(input()))
list_ = []
if x == 1:
    print((1))
else:
    b = 2
    while b**2 <= x:
        p = 2
        while b**p <= x:
            list_.append(b**p)
            p += 1
        b += 1
    print((max(list_)))

x = int(eval(input()))
ans = 1
if x == 1:
    print((1))
else:
    b = 2
    while b**2 <= x:
        p = 2
        while b**p <= x:
            ans = max(b**p, ans)
            p += 1
        b += 1
    print(ans)

-list_ = [] +ans = 1 -            list_.append(b**p) +            ans = max(b**p, ans) -    print((max(list_))) +    print(ans)