import sys
sInput = sys.stdin.readline()
while sInput != "":
sInput = sInput.split(" ") # 將兩個數字分開
iMin = int(sInput[0]) # 將小數放入下限
iMax = int(sInput[1]) # 將大數放入上限
lAns = []
j = len(sInput[0])
if (iMax > iMin) and (iMin > 0) and (iMax <= 1000000):
for i in range (iMin, iMax + 1):
t = i
iSum = 0
for k in range (0, j):
iSum += int(str(t)[k]) ** j
if i == iSum:
lAns.append(i)
if len(lAns) == 0:
print ("none")
else:
for n in range (0, len(lAns)):
print (lAns[n], end=" ")
print()
sInput = sys.stdin.readline()