import Control.Applicative
import Data.List(nub)

main = do
  n <- readLn
  if n == 0
     then return ()
     else do
--       print $ factors n primes [[1]]
       syori n
       main

syori n = do
  putStrLn $ hantei n

hantei :: Int -> [Char]
hantei n
  | length (factors n primes [[1]]) == 2 = "deficient number"
  | n*2 > product (map sum (factors n primes [[1]])) = "deficient number"
  | n*2 < product (map sum (factors n primes [[1]])) = "abundant number"
  | otherwise           = "perfect number"

factors :: Int -> [Int] -> [[Int]] -> [[Int]]
factors n (x:xs) ys
  | x * x > n   = (nub[1,n]:ys)
  | reM == 0 = factors' quoT (x:xs) [1,x] ys 2
  | otherwise    = factors n xs ys
  where
    (quoT,reM) = quotRem n x

factors' n (x:xs) zs ys m
  | reM == 0 = factors' quoT (x:xs) ((x^m):zs) ys (m+1)
  | otherwise = factors n xs (zs:ys)
  where
    (quoT,reM) = quotRem n x

primes :: [Int]
primes = takeWhile (<10000) $ 2:3:5:7: filter (null . tail . primeFactors) [11,13..]

primeFactors :: Int -> [Int]
primeFactors n = factor n primes
  where
    factor n (x:xs)
      | x * x > n   = [n]
      | reM == 0 = x : factor quoT (x:xs)
      | otherwise    = factor n xs
      where
        (quoT,reM) = quotRem n x