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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
            int x = Integer.parseInt(br.readLine());
            for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
            int x = Integer.parseInt(br.readLine());
            for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} Main public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
            int x = Integer.parseInt(br.readLine());
            for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    } main {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
            int x = Integer.parseInt(br.readLine());
            for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    } try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
            int x = Integer.parseInt(br.readLine());
            for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
            int x = Integer.parseInt(br.readLine());
            for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            }
        } InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br = new BufferedReader(isr); br new BufferedReader(isr) int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000}; arr {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000} 1 4 8 9 16 25 27 32 36 49 64 81 100 121 125 128 144 169 196 216 225 243 256 289 324 343 361 400 441 484 512 529 576 625 676 729 784 841 900 961 1000 int x = Integer.parseInt(br.readLine()); x Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            } int i = arr.length -1 ; int i = arr.length -1 ; i arr.length -1 arr.length arr arr.length 1 i >= 0 i 0 i-- i-- i {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            } {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            } if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                } x >= arr[i] x arr[i] arr i {
                    System.out.println(arr[i]);
                    break;
                } System.out.println(arr[i]) System.out.println System.out System System.out arr[i] arr i break; String[] args args public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
            int x = Integer.parseInt(br.readLine());
            for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
            int x = Integer.parseInt(br.readLine());
            for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int arr[] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
            int x = Integer.parseInt(br.readLine());
            for (int i = arr.length -1 ; i >= 0; i--) {
                if (x >= arr[i]) {
                    System.out.println(arr[i]);
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
