import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();

		// 平方根
		double tmp = Math.sqrt(X);
		int tmp2 = (int)tmp;
		double ans = Math.pow(tmp2, 2) ;

		// 立方根
		tmp = Math.cbrt(X);
		tmp2 = (int)tmp;
		double ans2 = Math.pow(tmp2, 3);

		// 5乗根
		tmp = Math.pow(X, 1.0 / 5.0);
		tmp2 = (int)tmp;
		double ans3 = Math.pow(tmp2, 5);

		if (ans >= ans2){
			if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			}
		}else{
			if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			}

		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();

		// 平方根
		double tmp = Math.sqrt(X);
		int tmp2 = (int)tmp;
		double ans = Math.pow(tmp2, 2) ;

		// 立方根
		tmp = Math.cbrt(X);
		tmp2 = (int)tmp;
		double ans2 = Math.pow(tmp2, 3);

		// 5乗根
		tmp = Math.pow(X, 1.0 / 5.0);
		tmp2 = (int)tmp;
		double ans3 = Math.pow(tmp2, 5);

		if (ans >= ans2){
			if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			}
		}else{
			if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			}

		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();

		// 平方根
		double tmp = Math.sqrt(X);
		int tmp2 = (int)tmp;
		double ans = Math.pow(tmp2, 2) ;

		// 立方根
		tmp = Math.cbrt(X);
		tmp2 = (int)tmp;
		double ans2 = Math.pow(tmp2, 3);

		// 5乗根
		tmp = Math.pow(X, 1.0 / 5.0);
		tmp2 = (int)tmp;
		double ans3 = Math.pow(tmp2, 5);

		if (ans >= ans2){
			if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			}
		}else{
			if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			}

		}
	} main {
		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();

		// 平方根
		double tmp = Math.sqrt(X);
		int tmp2 = (int)tmp;
		double ans = Math.pow(tmp2, 2) ;

		// 立方根
		tmp = Math.cbrt(X);
		tmp2 = (int)tmp;
		double ans2 = Math.pow(tmp2, 3);

		// 5乗根
		tmp = Math.pow(X, 1.0 / 5.0);
		tmp2 = (int)tmp;
		double ans3 = Math.pow(tmp2, 5);

		if (ans >= ans2){
			if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			}
		}else{
			if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			}

		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc double tmp = Math.sqrt(X); tmp Math.sqrt(X) Math.sqrt Math X int tmp2 = (int)tmp; tmp2 (int)tmp double ans = Math.pow(tmp2, 2) ; ans Math.pow(tmp2, 2) Math.pow Math tmp2 2 tmp = Math.cbrt(X) tmp Math.cbrt(X) Math.cbrt Math X tmp2 = (int)tmp tmp2 (int)tmp double ans2 = Math.pow(tmp2, 3); ans2 Math.pow(tmp2, 3) Math.pow Math tmp2 3 tmp = Math.pow(X, 1.0 / 5.0) tmp Math.pow(X, 1.0 / 5.0) Math.pow Math X 1.0 / 5.0 1.0 5.0 tmp2 = (int)tmp tmp2 (int)tmp double ans3 = Math.pow(tmp2, 5); ans3 Math.pow(tmp2, 5) Math.pow Math tmp2 5 if (ans >= ans2){
			if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			}
		}else{
			if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			}

		} ans >= ans2 ans ans2 {
			if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			}
		} if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			} ans >= ans3 ans ans3 {
				System.out.println((int)ans);
			} System.out.println((int)ans) System.out.println System.out System System.out (int)ans {
				System.out.println((int)ans3);
			} System.out.println((int)ans3) System.out.println System.out System System.out (int)ans3 {
			if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			}

		} if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			} ans2 >= ans3 ans2 ans3 {
				System.out.println((int)ans2);
			} System.out.println((int)ans2) System.out.println System.out System System.out (int)ans2 {
				System.out.println((int)ans3);
			} System.out.println((int)ans3) System.out.println System.out System System.out (int)ans3 String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();

		// 平方根
		double tmp = Math.sqrt(X);
		int tmp2 = (int)tmp;
		double ans = Math.pow(tmp2, 2) ;

		// 立方根
		tmp = Math.cbrt(X);
		tmp2 = (int)tmp;
		double ans2 = Math.pow(tmp2, 3);

		// 5乗根
		tmp = Math.pow(X, 1.0 / 5.0);
		tmp2 = (int)tmp;
		double ans3 = Math.pow(tmp2, 5);

		if (ans >= ans2){
			if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			}
		}else{
			if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			}

		}
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();

		// 平方根
		double tmp = Math.sqrt(X);
		int tmp2 = (int)tmp;
		double ans = Math.pow(tmp2, 2) ;

		// 立方根
		tmp = Math.cbrt(X);
		tmp2 = (int)tmp;
		double ans2 = Math.pow(tmp2, 3);

		// 5乗根
		tmp = Math.pow(X, 1.0 / 5.0);
		tmp2 = (int)tmp;
		double ans3 = Math.pow(tmp2, 5);

		if (ans >= ans2){
			if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			}
		}else{
			if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			}

		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();

		// 平方根
		double tmp = Math.sqrt(X);
		int tmp2 = (int)tmp;
		double ans = Math.pow(tmp2, 2) ;

		// 立方根
		tmp = Math.cbrt(X);
		tmp2 = (int)tmp;
		double ans2 = Math.pow(tmp2, 3);

		// 5乗根
		tmp = Math.pow(X, 1.0 / 5.0);
		tmp2 = (int)tmp;
		double ans3 = Math.pow(tmp2, 5);

		if (ans >= ans2){
			if (ans >= ans3){
				System.out.println((int)ans);
			}else{
				System.out.println((int)ans3);
			}
		}else{
			if(ans2 >= ans3){
				System.out.println((int)ans2);
			}else{
				System.out.println((int)ans3);
			}

		}
	}
}