#include<stdio.h>

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


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

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

		for(j=10;j<t;j++){
			if(s%j==0) sum+=j;
		}

	
    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;
}