public static void main(String[] args) throws IOException {
		Scanner scan = new Scanner(System.in);
		StringBuilder out = new StringBuilder();
		precal();
		out.append("PERFECTION OUTPUT\n");
		while (scan.hasNext()) {
			int v = scan.nextInt();
			if (v == 0)
				break;
			out.append(format(v) + "  ");
			if (v == dp[v])
				out.append("PERFECT");
			else if (v < dp[v])
				out.append("ABUNDANT");
			else
				out.append("DEFICIENT");
			out.append("\n");
		}
		out.append("END OF OUTPUT\n");
		System.out.print(out);
	}