#include <stdio.h>

int mysqrt(int n) {
	int left,right;
	long long mid;
	if(n==0)return 0;
	if(n<0)return -1;
	left=1;right=n;
	while(left<=right) {
		mid=(left+right)/2;
		if(mid*mid==n)return mid;
		else if(mid*mid<n)left=mid+1;
		else right=mid-1;
	}
	return left-1;
}

int main(void) {
	int query;
	int max;
	int sum;
	int i;
	while(1) {
		scanf("%d",&query);
		if(query==0)break;
		sum=1;
		max=mysqrt(query);
		for(i=2;i<=max;i++) {
			if(query%i==0) {
				sum+=i+query/i;
			}
		}
		if(max*max==query)sum-=max;
		if(sum==query)puts("perfect number");
		else if(sum<query)puts("deficient number");
		else puts("abundant number");
	}
	return 0;
}