#include<stdio.h>

int main(void){
int n[100];
int i,j,s,t,u,v,w,x,y,z;
int sum=0;

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

for(i=0;n[i]!=0;i++){
	s=n[i];
	t=s/10+1;
	sum+=1;
	if(s%2==0)sum+=2;
	if(s%3==0)sum+=3;
	if(s%4==0)sum+=4;
	if(s%5==0)sum+=5;
	if(s%6==0)sum+=6;
	if(s%7==0)sum+=7;
	if(s%8==0)sum+=8;
	if(s%9==0)sum+=9;

		for(j=10;j<s/10+1;j++){
			if(s%j==0) sum+=j;
		}
	if(s%s/9==0 && s%9==0)sum+=s/9;
	if(s%s/8==0 && s%8==0)sum+=s/8;
	if(s%s/7==0 && s%7==0)sum+=s/7;
	if(s%s/6==0 && s%6==0)sum+=s/6;
	if(s%s/5==0 && s%5==0)sum+=s/5;
	if(s%s/4==0 && s%4==0)sum+=s/4;
	if(s%s/3==0 && s%3==0)sum+=s/3;
	if(s%s/2==0 && s%2==0)sum+=s/2;

    if(sum==n[i]) printf("perfect number\n");
    else if(sum>n[i]) printf("abundant number\n");
    else if(sum<n[i]) printf("deficient number\n");
    sum=0;
}

return 0;
}