#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int cmp(int x)
{
    int ret = 0;
    for (int i = 1; i < x; i++)
        if (x % i == 0) ret += i;
    if (ret < x) return 0;
    if (ret == x) return 1;
    if (ret > x) return 2;
}
int main()
{
    char *ans[] = {"DEFICIENT", "PERFECT", "ABUNDANT"};
    puts("PERFECTION OUTPUT");
    for (int x; scanf("%d", &x), x;)
        printf("%5d  %s\n", x, ans[cmp(x)]);
    puts("END OF OUTPUT");
    return 0;
}
