# input N = gets.to_i A = N.times.map{ gets.to_i } # solve if A.uniq.size == 1 print -1 else kouho = (0..N).to_a result = A.map{|num| tmp = kouho.first == num ? kouho[1] : kouho[0] kouho.delete(tmp) tmp } result.each{|num| print "#{num}\n" } end