#include<iostream>
#include<cmath>
using namespace std;
 
int main()
{
	int a, b, c, n;
	cin>>n;
	int x = 100;
	do
	{
		a = x % 10;
		b = x / 10 % 10;
		c = x / 100 % 10;
		if (x==a*a*a+b*b*b+c*c*c)
			cout<<x<<" ";
		x++;
	} while (x <= n);
	return 0;
}