#include <iostream>
#include <math.h>
using namespace std;
// 這個函數
// 輸入:數字
// 輸出:是否為自戀數
int Solve(int n){
int Num = n;
int Fin[10000] = {};
int counter = 0;
// Fin是將數字拆項
while(n>0){
Fin[counter] = n%10;
counter ++;
n = n/10;
}
// wee是位數
int wee = counter;
int sum = 0;
for(int u = 0 ; u<wee ; u++){
sum += pow(Fin[u],wee);
}
if(Num == sum){
return 1;
}
}
int main(){
int first = 0 , end =0 ;
int c = 0;
while(cin>>first>>end){
for(int i = first;i<=end;i++){
if(Solve(i) == 1){
cout<<i<<" ";
c++;
}
}
if(c == 0){
cout << "none"<<endl;
}else{
cout<<endl;
}
c = 0;
}
}