inputs = STDIN.readlines.map(&:chomp) N = inputs[0].to_i Ws = inputs[1].split(/\s+/).map(&:to_i) class Omori def initialize(weight) @weight = weight end attr_reader :weight end def check(k, omoris) do_next = false omoris.combination(k) do |os1| sum1 = os1.map(&:weight).inject(:+) sum2 = (omoris - os1).map(&:weight).inject(:+) do_next = true if sum1 > sum2 return [true, false] if sum1 == sum2 end [false, do_next] end def main(omoris) n = omoris.size / 2 n.step(1, -1) do |k| result, do_next = check(k, omoris) return true if result break unless do_next end false end puts main(Ws.map { |w| Omori.new(w) }) ? 'possible' : 'impossible'