//找出完全平方数
//这题是暴力算法
//148K 94MS
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
set<vector<int> >vTriple;
bool isPerfectCube(int n){
bool bfind = false;
for (int i=2;i<n;++i)
for (int j=2;j<n;++j)
for (int k= 2;k<n;++k)
{
int sum1 =0;
sum1 +=(k*k*k+i*i*i+j*j*j);
if (sum1==n*n*n)
{
vector<int>trip;
trip.resize(3);
trip[0] = i;
trip[1] = j;
trip[2] = k;
sort(trip.begin(),trip.end());
vTriple.insert(trip);
bfind = true;
}
}
return bfind;
}
int main(){
int n;
scanf("%d",&n);
for (int j=3;j<=n;++j)
{
if (isPerfectCube(j))
{
set<vector<int> >::iterator iter = vTriple.begin();
for (iter;iter!=vTriple.end();++iter)
{
int a = (*iter)[0];
int b = (*iter)[1];
int c = (*iter)[2];
printf("Cube = %d, Triple = (%d,%d,%d)\n",j,a,b,c);
}
}
vTriple.clear();
}
return 0;
}