for number in range(1,1001):
s=0
for i in range(1,number):
if(number%i == 0):
s+=i
if(s == number):
print(number)
for number in range(1,1001):
s=0
for i in range(1,number):
if(number%i == 0):
s+=i
if(s == number):
print(number)