#include<stdio.h>

int main(void){
int n[100];
int i,j,s,t,u,v,w,x;
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=n[i]/6+1;

		for(j=1;j<t;j++){
			if(s%j==0) sum+=j;
		}
	if(n[i]%5==0){
		x=n[i]/5;
		if(s%x==0) sum+=x;
	}
	if(n[i]%4==0){
		w=n[i]/4;
		if(s%w==0) sum+=w;
	}	
	if(n[i]%3==0){
		u=n[i]/3;
		if(s%u==0) sum+=u;
	}
	if(n[i]%2==0){
		v=n[i]/2;
		if(s%v==0) sum+=v;
	}
	
    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;
}