Start

2017-09-13 00:00 CEST

PSU Meeting 1

End

2017-09-20 00:00 CEST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -72 days 0:06:52

Time elapsed

168:00:00

Time remaining

0:00:00

Problem G
Almost Perfect

A positive integer $p$ is called a perfect number if all the proper divisors of $p$ sum to $p$ exactly. Integer $d$ is a proper divisor of $p$ if $1 \le d \le p-1$ and $p$ is evenly divisible by $d$. For example, the number $28$ is a perfect number, since its proper divisors (which are $1$, $2$, $4$, $7$ and $14$) add up to $28$.

Perfect numbers are rare; only $10$ of them are known. Perhaps the definition of perfection is a little too strict. Instead, we will consider numbers that we’ll call almost perfect. Positive integer $p$ is almost perfect if the proper divisors of $p$ sum to a value that differs from $p$ by no more than two.

Input

Input consists of a sequence of up to $500$ integers, one per line. Each integer is in the range $2$ to $10^9$ (inclusive). Input ends at end of file.

Output

For each input value, output the same value and then one of the following: “perfect” (if the number is perfect), “almost perfect” (if it is almost perfect but not perfect), or “not perfect” (otherwise).

Sample Input 1 Sample Output 1
6
65
650
6 perfect
65 not perfect
650 almost perfect