#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=n[i]/2+1;
	u=n[i]/3+1;
	v=n[i]/4+1;
	w=n[i]/5+1;
	x=n[i]/6+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;

		for(j=6;j<x;j++){
			if(s%j==0) sum+=j;
		}
	if(s%w==0)sum+=w;
    if(s%v==0)sum+=v;
    if(s%u==0)sum+=u;
    if(s%t==0)sum+=t;
	
    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;
}