#include<stdio.h>
#define PSIZE 100000000

int pns[PSIZE+1];

int main(){
  int i,j,n,ie;
  for(i=1,ie=PSIZE/2;i<=ie;i++)
    for(j=i*2;j<=PSIZE;j+=i) pns[j]+=i;

  do{
    scanf("%d",&n);
    if(!n) break;
    printf("%s %d\n",pns[n]>n?"abundant number":
	   pns[n]==n?"perfect number":"deficient number",pns[n]);
  }while(1);
  return 0;
}