all_number = []
split_number = []
number = []
n = []
yn = []
start = int(input('請輸入開始值:'))
end = int(input('請輸入結束值'))
for i in range(start, end):
all_number.append(int(i))
all_number = [str(all_number) for all_number in all_number]
for i in range(len(all_number)):
split_number.append(list(all_number[i]))
for i in range(len(split_number)):
split_number[i] = [int(split_number[i]) for split_number[i] in split_number[i]]
number.append(split_number[i])
for i in range(len(number)):
for j in range(len(number[i])):
number[i][j] = number[i][j]**len(number[i])
for i in range(len(number)):
n.append(sum(number[i]))
all_number = [int(all_number) for all_number in all_number]
for i in range(len(n)):
if n[i] == all_number[i]:
yn.append(n[i])
if len(yn) >= 1:
for i in range(len(yn)):
print(yn[i],end=' ')
else:
print('none')