from math import sqrt

P = "perfect number"

D = "deficient number"

A = "abundant number"

while True:

    n = eval(input())

    if n==0:

        break

    if n==1:

        print(D)

        continue

    su = 1

    temp = n

    for i in range(2, int(sqrt(n))+1):

        cnt = 0

        while temp%i==0:

            temp /= i

            cnt += 1

        if cnt:

            su *= (i**(cnt+1)-1)/(i-1)

        if temp==1:

            su -= n

            break

    if temp!=1:

        su *= (temp**2-1)/(temp-1)

        su -= n

    print(P if n==su else (D if su<n else A))
P = "perfect number"

D = "deficient number"

A = "abundant number"

while True:

    n = int(input())

    if n==0:

        break

    if n==1:

        print(D)

        continue

    su = 1

    t = n

    i = 2

    while i**2<=t:

        if t%i==0:

            cnt = 0

            while t%i==0:

                t /= i

                cnt += 1

            su *= (i**(cnt+1)-1)/(i-1)

        i += 1

    if t>1:

        su *= (t**2-1)/(t-1)

    su -= n

    print(P if n==su else (D if su<n else A))
from math import sqrt

P = "perfect number"
D = "deficient number"
A = "abundant number"
while True:
    n = eval(input())
    if n == 0:
        break
    if n == 1:
        print(D)
        continue
    su = 1
    temp = n
    for i in range(2, int(sqrt(n)) + 1):
        cnt = 0
        while temp % i == 0:
            temp /= i
            cnt += 1
        if cnt:
            su *= (i ** (cnt + 1) - 1) / (i - 1)
        if temp == 1:
            su -= n
            break
    if temp != 1:
        su *= (temp**2 - 1) / (temp - 1)
        su -= n
    print(P if n == su else (D if su < n else A))

P = "perfect number"
D = "deficient number"
A = "abundant number"
while True:
    n = int(input())
    if n == 0:
        break
    if n == 1:
        print(D)
        continue
    su = 1
    t = n
    i = 2
    while i**2 <= t:
        if t % i == 0:
            cnt = 0
            while t % i == 0:
                t /= i
                cnt += 1
            su *= (i ** (cnt + 1) - 1) / (i - 1)
        i += 1
    if t > 1:
        su *= (t**2 - 1) / (t - 1)
    su -= n
    print(P if n == su else (D if su < n else A))

-from math import sqrt - -    n = eval(input()) +    n = int(input()) -    temp = n -    for i in range(2, int(sqrt(n)) + 1): -        cnt = 0 -        while temp % i == 0: -            temp /= i -            cnt += 1 -        if cnt: +    t = n +    i = 2 +    while i**2 <= t: +        if t % i == 0: +            cnt = 0 +            while t % i == 0: +                t /= i +                cnt += 1 -        if temp == 1: -            su -= n -            break -    if temp != 1: -        su *= (temp**2 - 1) / (temp - 1) -        su -= n +        i += 1 +    if t > 1: +        su *= (t**2 - 1) / (t - 1) +    su -= n