a=input().split() if int(a[0])0 and int(a[1])<1000000: for i in range(int(a[0]),int(a[1])): b=len(str(i)) if b==1: print(i,end=" ") if b==3 and int(max(a))>=153: n=str(i) s=(int(n[0])**b+int(n[1])**b+int(n[2])**b) if i==s: print(i,end=" ") if b==4: n=str(i) s=(int(n[0])**b+int(n[1])**b+int(n[2])**b+int(n[3])**b) if i==s: print(i,end=" ") if b==5: n=str(i) s=(int(n[0])**b+int(n[1])**b+int(n[2])**b+int(n[3])**b+int(n[4])**b) if i==s: print(i,end=" ") if b==6: n=str(i) s=(int(n[0])**b+int(n[1])**b+int(n[2])**b+int(n[3])**b+int(n[4])**b+int(n[5])**b) if i==s: print(i,end=" ") if b==2: print("none") if i>=100 and i<=152: print("none") if i>=1000 and i<=1633: print("none") if i>=10000 and i<=54747: print("none") if i>=100000 and i<=548833: print("none")