import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		int nums[] = { 8, 27, 64, 125, 216, 343, 512, 729, 1000, 32, 243, 128, 512 };
		for (int i = 1; i <= 32; i++) {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		int nums[] = { 8, 27, 64, 125, 216, 343, 512, 729, 1000, 32, 243, 128, 512 };
		for (int i = 1; i <= 32; i++) {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		int nums[] = { 8, 27, 64, 125, 216, 343, 512, 729, 1000, 32, 243, 128, 512 };
		for (int i = 1; i <= 32; i++) {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		int nums[] = { 8, 27, 64, 125, 216, 343, 512, 729, 1000, 32, 243, 128, 512 };
		for (int i = 1; i <= 32; i++) {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int input = sc.nextInt(); input sc.nextInt() sc.nextInt sc int nums[] = { 8, 27, 64, 125, 216, 343, 512, 729, 1000, 32, 243, 128, 512 }; nums { 8, 27, 64, 125, 216, 343, 512, 729, 1000, 32, 243, 128, 512 } 8 27 64 125 216 343 512 729 1000 32 243 128 512 for (int i = 1; i <= 32; i++) {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		} int i = 1; int i = 1; i 1 i <= 32 i 32 i++ i++ i {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		} {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		} if (input == i * i) {
				System.out.println(i * i);
				return;
			} input == i * i input i * i i i {
				System.out.println(i * i);
				return;
			} System.out.println(i * i) System.out.println System.out System System.out i * i i i return; if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			} (input > i * i) && input < (i + 1) * (i + 1) (input > i * i) input i * i i i input < (i + 1) * (i + 1) input (i + 1) * (i + 1) (i + 1) i 1 (i + 1) i 1 {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			} int binary = i * i; binary i * i i i for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				} int s nums {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				} {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				} if (s <= input && s > binary) {
						System.out.println(s);
						return;
					} s <= input && s > binary s <= input s input s > binary s binary {
						System.out.println(s);
						return;
					} System.out.println(s) System.out.println System.out System System.out s return; System.out.println(binary) System.out.println System.out System System.out binary return; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		int nums[] = { 8, 27, 64, 125, 216, 343, 512, 729, 1000, 32, 243, 128, 512 };
		for (int i = 1; i <= 32; i++) {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		int nums[] = { 8, 27, 64, 125, 216, 343, 512, 729, 1000, 32, 243, 128, 512 };
		for (int i = 1; i <= 32; i++) {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		int nums[] = { 8, 27, 64, 125, 216, 343, 512, 729, 1000, 32, 243, 128, 512 };
		for (int i = 1; i <= 32; i++) {

			if (input == i * i) {
				System.out.println(i * i);
				return;
			}

			if ((input > i * i) && input < (i + 1) * (i + 1)) {
				int binary = i * i;
				for (int s : nums) {
					if (s <= input && s > binary) {
						System.out.println(s);
						return;
					}
				}
				System.out.println(binary);
				return;
			}
		}
	}
}