X = int(eval(input()))



powers = {1}

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

    power = base

    while power <= X:

        powers.add(power)

        power *= base



print((max(powers)))

X = int(eval(input()))



powers = {1}

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

    power = base * base

    while power <= X:

        powers.add(power)

        power *= base



print((max(powers)))

X = int(eval(input()))
powers = {1}
for base in range(2, int(X**0.5) + 1):
    power = base
    while power <= X:
        powers.add(power)
        power *= base
print((max(powers)))

X = int(eval(input()))
powers = {1}
for base in range(2, int(X**0.5) + 1):
    power = base * base
    while power <= X:
        powers.add(power)
        power *= base
print((max(powers)))

-    power = base +    power = base * base