import java.util.Scanner;
public class ArmstrongNumber {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
//String in=sc.nextLine();
//String[] inArray=in.split(" ");
//char[] inCharArray1=inArray[0].toCharArray();
//char[] inCharArray2=inArray[1].toCharArray();
int a=sc.nextInt();
int b=sc.nextInt();
int count=0;
for (int i=a;i<=b;i++){
char [] chars = String.valueOf(i).toCharArray();
int total=0;
for(int j=0;j<chars.length;j++){
total+=Math.pow(Character.getNumericValue(chars[j]),chars.length);
}
if(total==i){
if(count==0){
System.out.print(i);
}
else{
System.out.print(" "+i);
}
count++;
}
}
if(count==0){
System.out.print("none");
}
System.out.println();
}
}
}