# 프로그래밍 문제 1
from __future__ import print_function
from sys import stdin

def printf(str, *args):
	print(str % args, end='')

for i in range(1, 2000+1):
	Per_num = 0
	j = 1
	while j < i:
		if (i % j) == 0:
			Per_num += j
		j += 1
	if Per_num == i:
		printf("%5d perfect number!!!\n" % i)

stdin.readline()