import java.util.*;
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        double a =sc.nextInt();

        double two=Math.sqrt(a);
        double three=Math.cbrt(a);
        double four=Math.pow(a,0.25);
        double five=Math.pow(a,0.2);

        double unti[];
        unti=new double[4];
        unti[0]=Math.floor(two);
        unti[1]=Math.floor(three);
        unti[2]=Math.floor(four);
        unti[3]=Math.floor(five);
        double max=0;
        for(int i=0;i<4;i++){
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        }
        int ans=(int)max;
        System.out.println(ans);


        
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        double a =sc.nextInt();

        double two=Math.sqrt(a);
        double three=Math.cbrt(a);
        double four=Math.pow(a,0.25);
        double five=Math.pow(a,0.2);

        double unti[];
        unti=new double[4];
        unti[0]=Math.floor(two);
        unti[1]=Math.floor(three);
        unti[2]=Math.floor(four);
        unti[3]=Math.floor(five);
        double max=0;
        for(int i=0;i<4;i++){
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        }
        int ans=(int)max;
        System.out.println(ans);


        
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        double a =sc.nextInt();

        double two=Math.sqrt(a);
        double three=Math.cbrt(a);
        double four=Math.pow(a,0.25);
        double five=Math.pow(a,0.2);

        double unti[];
        unti=new double[4];
        unti[0]=Math.floor(two);
        unti[1]=Math.floor(three);
        unti[2]=Math.floor(four);
        unti[3]=Math.floor(five);
        double max=0;
        for(int i=0;i<4;i++){
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        }
        int ans=(int)max;
        System.out.println(ans);


        
    } main {

        Scanner sc = new Scanner(System.in);
        double a =sc.nextInt();

        double two=Math.sqrt(a);
        double three=Math.cbrt(a);
        double four=Math.pow(a,0.25);
        double five=Math.pow(a,0.2);

        double unti[];
        unti=new double[4];
        unti[0]=Math.floor(two);
        unti[1]=Math.floor(three);
        unti[2]=Math.floor(four);
        unti[3]=Math.floor(five);
        double max=0;
        for(int i=0;i<4;i++){
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        }
        int ans=(int)max;
        System.out.println(ans);


        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double a =sc.nextInt(); a sc.nextInt() sc.nextInt sc double two=Math.sqrt(a); two Math.sqrt(a) Math.sqrt Math a double three=Math.cbrt(a); three Math.cbrt(a) Math.cbrt Math a double four=Math.pow(a,0.25); four Math.pow(a,0.25) Math.pow Math a 0.25 double five=Math.pow(a,0.2); five Math.pow(a,0.2) Math.pow Math a 0.2 double unti[]; unti unti=new double[4] unti new double[4] 4 unti[0]=Math.floor(two) unti[0] unti 0 Math.floor(two) Math.floor Math two unti[1]=Math.floor(three) unti[1] unti 1 Math.floor(three) Math.floor Math three unti[2]=Math.floor(four) unti[2] unti 2 Math.floor(four) Math.floor Math four unti[3]=Math.floor(five) unti[3] unti 3 Math.floor(five) Math.floor Math five double max=0; max 0 for(int i=0;i<4;i++){
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        } int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        } {
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        } double jo=Math.pow(unti[i],i+2); jo Math.pow(unti[i],i+2) Math.pow Math unti[i] unti i i+2 i 2 max=Math.max(max,jo) max Math.max(max,jo) Math.max Math max jo int ans=(int)max; ans (int)max System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        double a =sc.nextInt();

        double two=Math.sqrt(a);
        double three=Math.cbrt(a);
        double four=Math.pow(a,0.25);
        double five=Math.pow(a,0.2);

        double unti[];
        unti=new double[4];
        unti[0]=Math.floor(two);
        unti[1]=Math.floor(three);
        unti[2]=Math.floor(four);
        unti[3]=Math.floor(five);
        double max=0;
        for(int i=0;i<4;i++){
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        }
        int ans=(int)max;
        System.out.println(ans);


        
    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        double a =sc.nextInt();

        double two=Math.sqrt(a);
        double three=Math.cbrt(a);
        double four=Math.pow(a,0.25);
        double five=Math.pow(a,0.2);

        double unti[];
        unti=new double[4];
        unti[0]=Math.floor(two);
        unti[1]=Math.floor(three);
        unti[2]=Math.floor(four);
        unti[3]=Math.floor(five);
        double max=0;
        for(int i=0;i<4;i++){
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        }
        int ans=(int)max;
        System.out.println(ans);


        
    }
} Main
import java.util.*;
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        double a =sc.nextInt();

        double two=Math.sqrt(a);
        double three=Math.cbrt(a);
        double four=Math.pow(a,0.25);
        double five=Math.pow(a,0.2);

        double unti[];
        unti=new double[4];
        unti[0]=Math.floor(two);
        unti[1]=Math.floor(three);
        unti[2]=Math.floor(four);
        unti[3]=Math.floor(five);
        double max=0;
        for(int i=0;i<4;i++){
             double jo=Math.pow(unti[i],i+2);
            max=Math.max(max,jo);
        }
        int ans=(int)max;
        System.out.println(ans);


        
    }
}