Under construction

Still being built. Things may change

Deficient, Perfect, and Abundant

Interview

Time limit1sMemory limit128 MB

Summary
For each integer, sum its proper divisors and classify it as deficient, perfect, or abundant.
Level

Easy3 of 10

Topics
Math, Number theory, Implementation
Solved
No attempts yet

Problem

Read several positive integers and, for each one, determine whether it is deficient, perfect, or abundant.

The proper divisors of a positive integer nn are its divisors that include 11 but exclude nn itself. Let ss be the sum of the proper divisors of nn. Then:

  • if s=ns = n, the number is perfect;
  • if s<ns < n, the number is deficient;
  • if s>ns > n, the number is abundant.

For example, the proper divisors of 66 are 1,2,31, 2, 3, and their sum is 66, so 66 is a perfect number.

Input

The first line contains the number of integers that follow. Each of the next lines contains one integer. Every input integer is greater than 11 and less than 3250032500 (that is, 2≤n≤324992 \le n \le 32499).

Output

For each integer, output the number together with its classification on its own line:

  • n is a deficient number. if it is deficient;
  • n is a perfect number. if it is perfect;
  • n is an abundant number. if it is abundant.

Here n is the input value. Print one blank line between consecutive results.

Examples1

  1. Example 1

    Input
    3
    4
    6
    12
    
    Expected output
    4 is a deficient number.
    
    6 is a perfect number.
    
    12 is an abundant number.