loop do
  n = gets.to_i
  break if n == 0
  s = 1
  (2..Math.sqrt(n)).each do |m|
    if n % m == 0
      s += m; s += n / m
      s -= m if m == n / m
    end
  end
  if n > s || n == 1 then puts "deficient number"
  elsif n < s then puts "abundant number"
  else puts "perfect number"
  end
end