# 最简单的 且运行正确
n=int(input())
for num in range(10**(n-1),10**(n)):
if num==sum([int(i)**n for i in str(num)]):
print(num)
## 这一段代码提交后显示运行超时
## 还有个问题:这段代码输出的是多个水仙花数,要比题给示例还多,就是,当时没看清题,要求输出的是N位,这段代码能输出不止N位数的水仙花数
n=input()
max_n = 1
for i in range(int(n)):
max_n = max_n*10
def isNarcissistic(N):
li=list(str(N))
s=0
for i,j in enumerate(li):
s_k = 1
for k in range(len(li)):
s_k = s_k* int(j)
s +=s_k
if s==N:
return True
else:
return False
nar=[]
for num in range(100,max_n):
if isNarcissistic(num):
nar.append(num)
for i in nar:
print(i)