
import java.util.Scanner;

/**
 * Created by oka on 2018/06/05.
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
            return;
        }

        int b = 2;
        int pow = b;
        int counter = 1;
        int max = 1;
        while (true) {
            pow *= b;
            counter++;
            if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            }
        }
        System.out.println(max);
    }
} 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();
        if (x == 1) {
            System.out.println(1);
            return;
        }

        int b = 2;
        int pow = b;
        int counter = 1;
        int max = 1;
        while (true) {
            pow *= b;
            counter++;
            if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            }
        }
        System.out.println(max);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
            return;
        }

        int b = 2;
        int pow = b;
        int counter = 1;
        int max = 1;
        while (true) {
            pow *= b;
            counter++;
            if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            }
        }
        System.out.println(max);
    } main {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
            return;
        }

        int b = 2;
        int pow = b;
        int counter = 1;
        int max = 1;
        while (true) {
            pow *= b;
            counter++;
            if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            }
        }
        System.out.println(max);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc if (x == 1) {
            System.out.println(1);
            return;
        } x == 1 x 1 {
            System.out.println(1);
            return;
        } System.out.println(1) System.out.println System.out System System.out 1 return; int b = 2; b 2 int pow = b; pow b int counter = 1; counter 1 int max = 1; max 1 while (true) {
            pow *= b;
            counter++;
            if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            }
        } true {
            pow *= b;
            counter++;
            if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            }
        } pow *= b pow b counter++ counter if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            } pow > x pow x {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                } counter == 2 counter 2 {
                    break;
                } break; {
                    b++;
                    pow = b;
                    counter = 1;
                } b++ b pow = b pow b counter = 1 counter 1 {
                if (max < pow) {
                    max = pow;
                }
            } if (max < pow) {
                    max = pow;
                } max < pow max pow {
                    max = pow;
                } max = pow max pow System.out.println(max) System.out.println System.out System System.out max String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
            return;
        }

        int b = 2;
        int pow = b;
        int counter = 1;
        int max = 1;
        while (true) {
            pow *= b;
            counter++;
            if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            }
        }
        System.out.println(max);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
            return;
        }

        int b = 2;
        int pow = b;
        int counter = 1;
        int max = 1;
        while (true) {
            pow *= b;
            counter++;
            if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            }
        }
        System.out.println(max);
    }
} Main

import java.util.Scanner;

/**
 * Created by oka on 2018/06/05.
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
            return;
        }

        int b = 2;
        int pow = b;
        int counter = 1;
        int max = 1;
        while (true) {
            pow *= b;
            counter++;
            if (pow > x) {
                if (counter == 2) {
                    break;
                } else {
                    b++;
                    pow = b;
                    counter = 1;
                }
            } else {
                if (max < pow) {
                    max = pow;
                }
            }
        }
        System.out.println(max);
    }
}
