BETA
This is a school problem. Successful submissions of this are not counted in user ratings.

Submissions : 3581 Accuracy :

25.89

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 Examples Use Expected Output**


Contributor: karan kumar

Set Default Code

					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



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