BETA
School Problem's Submission isn't counted in score!

Submissions: 3766 Accuracy:

26.9%

Perfect Number
     

Check if  a given number is perfect or not. A number is perfect if  sum of factorial of its digit is equal to the given number. For example 145 is a Perfect Number because 1! + 4! + 5! = 145

Input:

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The next T lines will contain an integer N.

Output:
Corresponding to each test case, in a new line, print "Perfect " if it follow above condition else print "Not Perfect"  without quotes.

Constraints:

1 ≤ T ≤ 50

1 ≤ N ≤ 10000


Example:

Input:

2

23

145

Output:
Not Perfect
Perfect

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: karan kumar

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.