import java.util.*;
class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int num = 1;

        for(int i = 2; i <= 31; i++)
        {
            for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            }
        }
        System.out.print(num);
        scan.close();
    }
} import java.util.*; util.* java class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int num = 1;

        for(int i = 2; i <= 31; i++)
        {
            for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            }
        }
        System.out.print(num);
        scan.close();
    }
} Main public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int num = 1;

        for(int i = 2; i <= 31; i++)
        {
            for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            }
        }
        System.out.print(num);
        scan.close();
    } main {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int num = 1;

        for(int i = 2; i <= 31; i++)
        {
            for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            }
        }
        System.out.print(num);
        scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan int num = 1; num 1 for(int i = 2; i <= 31; i++)
        {
            for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            }
        } int i = 2; int i = 2; i 2 i <= 31 i 31 i++ i++ i {
            for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            }
        } {
            for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            }
        } for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            } int j = 10; int j = 10; j 10 j > 1 j 1 j-- j-- j {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            } {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            } double tmp = Math.pow(i, j); tmp Math.pow(i, j) Math.pow Math i j if(tmp <= x && tmp > num) num = (int) tmp; tmp <= x && tmp > num tmp <= x tmp x tmp > num tmp num num = (int) tmp num (int) tmp System.out.print(num) System.out.print System.out System System.out num scan.close() scan.close scan String[] args args
import java.util.*;
class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int num = 1;

        for(int i = 2; i <= 31; i++)
        {
            for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            }
        }
        System.out.print(num);
        scan.close();
    }
}