#include<stdio.h>
#include<string.h>

int main(){

int n[100];
int i=0;
int j;
int sum=0;
int tmp;

do{
scanf("%d",&n[i]);
i++;
}while(n[i-1]!=0);

for(i=0;n[i]!=0;i++){
    for(j=1;j<n[i]/5+1;j++){
        if(n[i]%j==0){
            sum+=j;
        }
    }
    if(n[i]%2==0) sum+=2;
    if(n[i]%3==0) sum+=3;
    if(n[i]%4==0) sum+=4;
    if(n[i]%5==0) sum+=5;
    if(n[i]==sum) printf("perfect number\n");
    else if(n[i]>sum) printf("deficient number\n");
    else printf("abundant number\n");
    sum=0;
}
return 0;
}