AOJ2101 Perfect Number

#include<iostream>
using namespace std;

int main(){
	int n, f;
	while(cin >> n, n != 0){
		f = 0;
		for(int i = 1; i * i <= n; i++){
			if(n % i ==0){
				f += i + n / i;
				if(n == i * i){
					f -= i;
				}
			}
		}
		if(f > n * 2)cout << "abundant number" << endl;
		else if(f < n * 2)cout << "deficient number" << endl;
		else cout << "perfect number" << endl;
	}
	return 0;
}