import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int[] a = {1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,169,289,361,529,841,961,36,216,100,1000,144,196,225,256,324,400,441,484,576,676,784,900};
  int x = sc.nextInt();
  Arrays.sort(a);
  for(int i = a.length-1;i >= 0;i--){
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  }
}} import java.util.*; util.* java public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int[] a = {1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,169,289,361,529,841,961,36,216,100,1000,144,196,225,256,324,400,441,484,576,676,784,900};
  int x = sc.nextInt();
  Arrays.sort(a);
  for(int i = a.length-1;i >= 0;i--){
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  }
}} Main public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int[] a = {1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,169,289,361,529,841,961,36,216,100,1000,144,196,225,256,324,400,441,484,576,676,784,900};
  int x = sc.nextInt();
  Arrays.sort(a);
  for(int i = a.length-1;i >= 0;i--){
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  }
} main {
Scanner sc = new Scanner(System.in);
  int[] a = {1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,169,289,361,529,841,961,36,216,100,1000,144,196,225,256,324,400,441,484,576,676,784,900};
  int x = sc.nextInt();
  Arrays.sort(a);
  for(int i = a.length-1;i >= 0;i--){
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  }
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] a = {1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,169,289,361,529,841,961,36,216,100,1000,144,196,225,256,324,400,441,484,576,676,784,900}; a {1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,169,289,361,529,841,961,36,216,100,1000,144,196,225,256,324,400,441,484,576,676,784,900} 1 4 8 16 32 64 128 256 512 9 27 81 243 729 25 125 625 49 343 121 169 289 361 529 841 961 36 216 100 1000 144 196 225 256 324 400 441 484 576 676 784 900 int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc Arrays.sort(a) Arrays.sort Arrays a for(int i = a.length-1;i >= 0;i--){
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  } int i = a.length-1; int i = a.length-1; i a.length-1 a.length a a.length 1 i >= 0 i 0 i-- i-- i {
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  } {
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  } if(a[i] <= x){
      System.out.println(a[i]);
      break;
    } a[i] <= x a[i] a i x {
      System.out.println(a[i]);
      break;
    } System.out.println(a[i]) System.out.println System.out System System.out a[i] a i break; String[] args args public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int[] a = {1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,169,289,361,529,841,961,36,216,100,1000,144,196,225,256,324,400,441,484,576,676,784,900};
  int x = sc.nextInt();
  Arrays.sort(a);
  for(int i = a.length-1;i >= 0;i--){
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  }
}} public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int[] a = {1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,169,289,361,529,841,961,36,216,100,1000,144,196,225,256,324,400,441,484,576,676,784,900};
  int x = sc.nextInt();
  Arrays.sort(a);
  for(int i = a.length-1;i >= 0;i--){
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  }
}} Main
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int[] a = {1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,169,289,361,529,841,961,36,216,100,1000,144,196,225,256,324,400,441,484,576,676,784,900};
  int x = sc.nextInt();
  Arrays.sort(a);
  for(int i = a.length-1;i >= 0;i--){
    if(a[i] <= x){
      System.out.println(a[i]);
      break;
    }
  }
}}
