import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int x = scanner.nextInt();
        int max = 1;
        for (int i = 2; i <= x; i++) {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        }
        System.out.println(max);
    }
} import java.util.*; util.* java public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int x = scanner.nextInt();
        int max = 1;
        for (int i = 2; i <= x; i++) {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        }
        System.out.println(max);
    }
} Main static Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) public static void main(String[]$) {
        int x = scanner.nextInt();
        int max = 1;
        for (int i = 2; i <= x; i++) {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        }
        System.out.println(max);
    } main {
        int x = scanner.nextInt();
        int max = 1;
        for (int i = 2; i <= x; i++) {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        }
        System.out.println(max);
    } int x = scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner int max = 1; max 1 for (int i = 2; i <= x; i++) {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        } int i = 2; int i = 2; i 2 i <= x i x i++ i++ i {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        } {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        } int j = i; j i while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            } true {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            } j *= i j i if (j > x) {
                    break;
                } j > x j x {
                    break;
                } break; max = Math.max(max, j) max Math.max(max, j) Math.max Math max j System.out.println(max) System.out.println System.out System System.out max String[]$ $ public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int x = scanner.nextInt();
        int max = 1;
        for (int i = 2; i <= x; i++) {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        }
        System.out.println(max);
    }
} public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int x = scanner.nextInt();
        int max = 1;
        for (int i = 2; i <= x; i++) {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        }
        System.out.println(max);
    }
} Main
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int x = scanner.nextInt();
        int max = 1;
        for (int i = 2; i <= x; i++) {
            int j = i;
            while (true) {
                j *= i;
                if (j > x) {
                    break;
                }
                max = Math.max(max, j);
            }
        }
        System.out.println(max);
    }
}