Problem: You are given two integers n and d. You need to construct a rooted binary tree consisting of n vertices with a root at the vertex 1 and the sum of depths of all vertices equals to d.

A tree is a connected graph without cycles. A rooted tree has a special vertex called the root. A parent of a vertex v is the last different from v vertex on the path from the root to the vertex v. The depth of the vertex v is the length of the path from the root to the vertex v. Children of vertex v are all vertices for which v is the parent. The binary tree is such a tree that no vertex has more than 2 children.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 1000) — the number of test cases.

The only line of each test case contains two integers n and d (2 ≤ n, d ≤ 5000) — the number of vertices in the tree and the required sum of depths of all vertices.

It is guaranteed that the sum of n and the sum of d both does not exceed 5000 (∑ n ≤ 5000, ∑ d ≤ 5000).

Output

For each test case, print the answer.

If it is impossible to construct such a tree, print "NO" (without quotes) in the first line. Otherwise, print "{YES}" in the first line. Then print n-1 integers p_2, p_3, ..., p_n in the second line, where p_i is the parent of the vertex i. Note that the sequence of parents you print should describe some binary tree.

Example

Input


3
5 7
10 19
10 18


Output


YES
1 2 1 3 
YES
1 2 3 3 9 9 2 1 6 
NO

Note

Pictures corresponding to the first and the second test cases of the example:

<image>

<image>

Solution (in JAVA):

Solution:
// Don't place your source in a package


import javax.swing.*;
import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
import java.util.stream.Stream;



// Please name your class Main
public class Main {
    static FastScanner fs=new FastScanner();
    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }
        int Int() {
            return Integer.parseInt(next());
        }

        long Long() {
            return Long.parseLong(next());
        }

        String Str(){
            return next();
        }
    }


    public static void main (String[] args) throws java.lang.Exception {
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        //reading /writing file
        //Scanner sc=new Scanner(new File("input.txt"));
        //PrintWriter pr=new PrintWriter("output.txt");



        int T=Int();
        for(int t=0;t<T;t++){
            int n=Int();
            int d=Int();
            Solution sol=new Solution(out);
            sol.solution(n,d);
        }
        out.close();

    }


    public static int[] Arr(int n){
        int A[]=new int[n];
        for(int i=0;i<n;i++)A[i]=Int();
        return A;
    }
    public static int Int(){
        return fs.Int();
    }
    public static long Long(){
        return fs.Long();
    }
    public static String Str(){
        return fs.Str();
    }

}








class Solution {
    PrintWriter out;
    int INF = Integer.MAX_VALUE;
    int MOD = 1000000007;

    public Solution(PrintWriter out) {
        this.out = out;
    }


    int res[];
    Queue<Integer>next=new LinkedList<>();
    public void solution(int n,int d) {
        int p[]=cal(2,1,n-1);
        //System.out.println(Arrays.toString(p));
        if(d<p[0]||d>p[1]){
            out.println("NO");
            return;
        }
        res=new int[n];
        for(int i=1;i<n;i++){
            next.add(i);
        }





        Queue<Integer>q=new LinkedList<>();
        q.add(0);
        int level=0;

        while(next.size()>0){
            int size=q.size();
            n-=size;
            level++;
            List<Integer>list=new ArrayList<>();
            for(int i=0;i<size;i++){
                int root=q.poll();
                list.add(root);
            }

            int j = -1;
            for(int i=1;i<=list.size()*2;i++){
                int pair[]=cal((i)*2,level+1,n-(i));

                //System.out.println(list);
               // System.out.println(i+"  "+Arrays.toString(pair)+"  "+level+"   "+d);
                //System.out.println();

                int D=d-(i*level);
                if(D>=pair[0]&&D<=pair[1]){
                    j=i;
                    break;
                }
            }


            //System.out.println(j);



            d-=level*j;

            for(int i=0;i<list.size();i++){
                if(j==0)break;
                int root=list.get(i);

                if(j>0){
                    int child=next();
                    add(root,child);
                    q.add(child);
                    j--;
                }

                if(j>0){
                    int child=next();
                    add(root,child);
                    q.add(child);
                    j--;
                }
            }
        }




        out.println("YES");
        for(int i=1;i<res.length;i++){
            out.print((res[i]+1)+" ");
        }
        out.println();

    }

    public int next(){
        return next.poll();
    }

    public int[] cal(int cnt,int level,int n){
        int lo=0;
        int hi=(level+level+ n - 1)*(n) / 2;
        while(true){
            if(n>cnt){
                lo+=cnt*level;
                n-=cnt;
            }
            else{
                lo+=n*level;
                n=0;
                break;
            }
            level++;
            cnt*=2;
        }

        return new int[]{lo,hi};
    }

    public void add(int parent,int child){
        res[child]=parent;
    }

}