#!/bin/ruby q = gets.strip.to_i for a0 in (0..q-1) len,c = gets.strip.split(' ') len = len.to_i c = c.to_i max = len * (len - 1) / 2 if c > max puts -1 elsif max == c puts (1..len).to_a.reverse.join(' ') else diff = max - c arr = (1..len).to_a.reverse diff.times { arr.rotate! } puts arr.join(' ') end end