#include <iostream.h>

#include <conio.h>

#include <math.h>

int main()

{

long n=1,i,j,flag,s,k; //initializing

long p=3; //replace 'p' to check for any other power

while(1) //loop till infinity

{

flag=0;k=pow(n,p);

for(i=1;pow(i,p)<k;i++) //looping first number

{

for(j=i+1;pow(i,p)+pow(j,p)<=k;j++) //looping second number

{

s=pow(i,p)+pow(j,p);

if(s==k){flag++;}

if(flag==2){break;} //break out of loop if found

}

if(flag==2){break;}

}

if(flag==2){cout<<n;break;} //print number if found and the program terminates

n++;

}

return 0;

}