def solve(lines) lines.each do |line| chars = line.split puts chars[1..].map(&:to_i).sort.reverse.join(' ') end end n = gets.to_i lines = n.times.map do gets.chomp end solve(lines)