n = gets.to_i (1..n).each do |i| l = gets.split(' ').map{|l| l.to_i} l = l[1, l.size - 1] l.sort.each do |l| print "#{l} " end print "\n" end