import java.util.*;
import java.lang.Math;
public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int X = sc.nextInt();
      int Y = 0;
      int[] x2 = new int[50];
      for(int i=0;i<32;i++){
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      }
      for(int j=0;j<11;j++){
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      }
      int[] a = {16,81,256,625,32,243,64,729,128,256,512};
      for(int k=0;k<11;k++){
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      }
          if(X==1000){System.out.println(1000);}else{System.out.println(Y);}
    }
} import java.util.*; util.* java import java.lang.Math; Math java.lang public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int X = sc.nextInt();
      int Y = 0;
      int[] x2 = new int[50];
      for(int i=0;i<32;i++){
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      }
      for(int j=0;j<11;j++){
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      }
      int[] a = {16,81,256,625,32,243,64,729,128,256,512};
      for(int k=0;k<11;k++){
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      }
          if(X==1000){System.out.println(1000);}else{System.out.println(Y);}
    }
} Main public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int X = sc.nextInt();
      int Y = 0;
      int[] x2 = new int[50];
      for(int i=0;i<32;i++){
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      }
      for(int j=0;j<11;j++){
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      }
      int[] a = {16,81,256,625,32,243,64,729,128,256,512};
      for(int k=0;k<11;k++){
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      }
          if(X==1000){System.out.println(1000);}else{System.out.println(Y);}
    } main {
      Scanner sc = new Scanner(System.in);
      int X = sc.nextInt();
      int Y = 0;
      int[] x2 = new int[50];
      for(int i=0;i<32;i++){
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      }
      for(int j=0;j<11;j++){
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      }
      int[] a = {16,81,256,625,32,243,64,729,128,256,512};
      for(int k=0;k<11;k++){
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      }
          if(X==1000){System.out.println(1000);}else{System.out.println(Y);}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int Y = 0; Y 0 int[] x2 = new int[50]; x2 new int[50] 50 for(int i=0;i<32;i++){
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      } int i=0; int i=0; i 0 i<32 i 32 i++ i++ i {
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      } {
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      } x2[i]=i*i x2[i] x2 i i*i i i if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        } Y<x2[i]&&x2[i]<=X Y<x2[i] Y x2[i] x2 i x2[i]<=X x2[i] x2 i X {
        	Y=x2[i];
        } Y=x2[i] Y x2[i] x2 i for(int j=0;j<11;j++){
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      } int j=0; int j=0; j 0 j<11 j 11 j++ j++ j {
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      } {
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      } x2[j+31]=j*j*j x2[j+31] x2 j+31 j 31 j*j*j j*j*j j j j if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        } Y<x2[j]&&x2[j]<=X Y<x2[j] Y x2[j] x2 j x2[j]<=X x2[j] x2 j X {
        	Y=x2[j];
        } Y=x2[j] Y x2[j] x2 j int[] a = {16,81,256,625,32,243,64,729,128,256,512}; a {16,81,256,625,32,243,64,729,128,256,512} 16 81 256 625 32 243 64 729 128 256 512 for(int k=0;k<11;k++){
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      } int k=0; int k=0; k 0 k<11 k 11 k++ k++ k {
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      } {
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      } if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        } Y<a[k]&&a[k]<=X Y<a[k] Y a[k] a k a[k]<=X a[k] a k X {
        	Y=a[k];
        } Y=a[k] Y a[k] a k if(X==1000){System.out.println(1000);}else{System.out.println(Y);} X==1000 X 1000 {System.out.println(1000);} System.out.println(1000) System.out.println System.out System System.out 1000 {System.out.println(Y);} System.out.println(Y) System.out.println System.out System System.out Y String[] args args public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int X = sc.nextInt();
      int Y = 0;
      int[] x2 = new int[50];
      for(int i=0;i<32;i++){
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      }
      for(int j=0;j<11;j++){
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      }
      int[] a = {16,81,256,625,32,243,64,729,128,256,512};
      for(int k=0;k<11;k++){
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      }
          if(X==1000){System.out.println(1000);}else{System.out.println(Y);}
    }
} public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int X = sc.nextInt();
      int Y = 0;
      int[] x2 = new int[50];
      for(int i=0;i<32;i++){
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      }
      for(int j=0;j<11;j++){
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      }
      int[] a = {16,81,256,625,32,243,64,729,128,256,512};
      for(int k=0;k<11;k++){
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      }
          if(X==1000){System.out.println(1000);}else{System.out.println(Y);}
    }
} Main
import java.util.*;
import java.lang.Math;
public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int X = sc.nextInt();
      int Y = 0;
      int[] x2 = new int[50];
      for(int i=0;i<32;i++){
        x2[i]=i*i;
        if(Y<x2[i]&&x2[i]<=X){
        	Y=x2[i];
        }
      }
      for(int j=0;j<11;j++){
      	x2[j+31]=j*j*j;
        if(Y<x2[j]&&x2[j]<=X){
        	Y=x2[j];
        }
      }
      int[] a = {16,81,256,625,32,243,64,729,128,256,512};
      for(int k=0;k<11;k++){
      	if(Y<a[k]&&a[k]<=X){
        	Y=a[k];
        }
      }
          if(X==1000){System.out.println(1000);}else{System.out.println(Y);}
    }
}