import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int X = Integer.parseInt(s);

            int e = 1;
            if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            }

            System.out.println(e);
        }
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int X = Integer.parseInt(s);

            int e = 1;
            if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            }

            System.out.println(e);
        }
    }
} Main public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int X = Integer.parseInt(s);

            int e = 1;
            if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            }

            System.out.println(e);
        }
    } main {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int X = Integer.parseInt(s);

            int e = 1;
            if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            }

            System.out.println(e);
        }
    } try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int X = Integer.parseInt(s);

            int e = 1;
            if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            }

            System.out.println(e);
        } {
            final String s = reader.readLine();

            int X = Integer.parseInt(s);

            int e = 1;
            if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            }

            System.out.println(e);
        } BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) new BufferedReader(
                new InputStreamReader(System.in)) final String s = reader.readLine(); s reader.readLine() reader.readLine reader int X = Integer.parseInt(s); X Integer.parseInt(s) Integer.parseInt Integer s int e = 1; e 1 if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            } X == 1 X 1 e = X e X {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            } for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                } int i = 2; int i = 2; i 2 i <= X i X i++ i++ i {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                } {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                } for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    } int j = 2; int j = 2; j 2 j <= X j X j++ j++ j {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    } {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    } if (X < Math.pow(i, j)) break; X < Math.pow(i, j) X Math.pow(i, j) Math.pow Math i j break; if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j); e < (int)Math.pow(i, j) e (int)Math.pow(i, j) Math.pow Math i j e = (int)Math.pow(i, j) e (int)Math.pow(i, j) Math.pow Math i j System.out.println(e) System.out.println System.out System System.out e String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int X = Integer.parseInt(s);

            int e = 1;
            if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            }

            System.out.println(e);
        }
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int X = Integer.parseInt(s);

            int e = 1;
            if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            }

            System.out.println(e);
        }
    }
} Main
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int X = Integer.parseInt(s);

            int e = 1;
            if (X == 1) e = X;
            else {
                for (int i = 2; i <= X; i++) {
                    for (int j = 2; j <= X; j++) {
                        if (X < Math.pow(i, j)) break;
                        if (e < (int)Math.pow(i, j))
                            e = (int)Math.pow(i, j);
                    }
                }
            }

            System.out.println(e);
        }
    }
}
