n,*a=(gets+gets).split.map(&:to_i);z=[];n.times{|i|(i+1...n).each{|j|if a[i]