#include <iostream>
#include <cstdio>
using namespace std ;
int main ()
{
int n , i , a ,p=0 ;
while (scanf ("%d",&a) ==1 && a!= 0)
{
n=0 ;p++ ;
for (i=1 ; i<=a/2 ; i++)
{
if (a%i==0) n=n+i ;
}
if (p==1) cout<<"PERFECTION OUTPUT"<<endl ;
if (n==a) printf ("%5d PERFECT\n",a) ;
else if (n>a) printf ("%5d ABUNDANT\n",a) ;
else if (n<a) printf ("%5d DEFICIENT\n",a) ;
}
if (a==0) cout<<"END OF OUTPUT"<<endl ;
return 0 ;
}
#include <cstdio>
using namespace std ;
int main ()
{
int n , i , a ,p=0 ;
while (scanf ("%d",&a) ==1 && a!= 0)
{
n=0 ;p++ ;
for (i=1 ; i<=a/2 ; i++)
{
if (a%i==0) n=n+i ;
}
if (p==1) cout<<"PERFECTION OUTPUT"<<endl ;
if (n==a) printf ("%5d PERFECT\n",a) ;
else if (n>a) printf ("%5d ABUNDANT\n",a) ;
else if (n<a) printf ("%5d DEFICIENT\n",a) ;
}
if (a==0) cout<<"END OF OUTPUT"<<endl ;
return 0 ;
}