You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.
x = int(input())

ans = 0
for i in range(100):
    for j in range(100):
        if i ** j <= x:
            ans = max(ans, i ** j)

print(ans)

x = int(input())

ans = 1
for b in range(1, 100):
    for p in range(2, 100):
        if b ** p <= x:
            ans = max(ans, b ** p)

print(ans)
