#include <iostream>
using namespace std;
int main()
{
for (int i = 111; i <= 999; ++i) {
int a = i / 100;
a = a*a*a;
int b = i %100/10;
b = b*b*b;
int c = i % 10;
c = c*c*c;
if (a!=b&&a!=c&&b!=c&&a+b+c == i) {
cout << i << endl;
}
}
return 0;
}