loop do
  n = gets.to_i
  break if n == 0
  s = (1..Math.sqrt(n)).each_with_object([]) { |m, arr|
    n % m == 0 ? arr << m << n / m : arr
  }.uniq.reduce(:+) - n
  if n > s then puts "deficient number"
  elsif n < s then puts "abundant number"
  else puts "perfect number"
  end
end