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:
import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //Into the Hardware Mode
    void pre() throws Exception{}
    void solve(int TC)throws Exception {
        int n = ni(), d = ni();
        int[] p = new int[1+n];
        int[] dep = new int[1+n];
        int[] deg = new int[1+n];
        int sum = 0;
        for(int i = 2; i<= n; i++) {
            dep[i] = i-1;
            p[i] = i-1;
            deg[i-1]++;
            sum += dep[i];
        }
        if(sum < d){
            pn("NO");return;
        }
        TreeSet<Integer>[] set = new TreeSet[1+n];
        for(int i = 0; i<= n; i++)set[i] = new TreeSet<>();
        for(int i = 1; i<= n; i++)if(deg[i] < 2)set[dep[i]].add(i);
        for(int i = n; i>= 1 && sum >= d; i--){
            if(deg[i] > 0)break;
            set[dep[i]].remove(i);
            int pdep = dep[p[i]];
            int delta = 0;
            deg[p[i]]--;
            set[dep[p[i]]].add(p[i]);
            while(pdep > 0 && set[pdep-1].size() > 0 && d < sum-delta){
                pdep--;
                delta++;
            }
            if(delta == 0)break;
            sum -= delta;
            int x = set[pdep].first();
            dep[i] = dep[x]+1;
            p[i] = x;
            deg[x]++;
            if(deg[x] == 2)set[dep[x]].remove(x);
            set[dep[i]].add(i);
        }
        if(sum > d)pn("NO");
        else {
            pn("YES");
            for(int i = 2; i<= n; i++)p(p[i]+" ");pn("");
        }
//
//        for(int i = 0; i< n; i++)set[i] = new TreeSet<>();
//        TreeSet<Integer> leaf = new TreeSet<>((Integer i1, Integer i2) -> {
//            if(dep[i1] != dep[i2])return Integer.compare(dep[i2], dep[i1]);
//            return Integer.compare(i1, i2);
//        });
//        for(int i = 0; i< n; i++)if(deg[i] == 0)leaf.add(i);
//
//        int sum = 0;
//        for(int i = 1; i<= n; i++)sum += dep[i];
//        int[] deg = new int[n];
//        for(int i = 0; i< n; i++){
//
//        }
//        if (sum > d || (n*n-n)/2 < d) {
//            pn("NO");
//            return;
//        }
//        for(int i = n; i>= 1 && sum < d; i--){
//            if(bit(i) == 1)continue;
//
//        }
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    void exit(boolean b){if(!b)System.exit(0);}
    long IINF = (long)1e15;
    final int INF = (int)1e9+2, MX = (int)2e6+5;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = true, memory = false, fileIO = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        long ct = System.currentTimeMillis();
        if (fileIO) {
            in = new FastReader("");
            out = new PrintWriter("");
        } else {
            in = new FastReader();
            out = new PrintWriter(System.out);
        }
        //Solution Credits: Taranpreet Singh
        int T = (multipleTC) ? ni() : 1;
        pre();
        for (int t = 1; t <= T; t++) solve(t);
        out.flush();
        out.close();
        System.err.println(System.currentTimeMillis() - ct);
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}
    int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str;
            try{
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }
            return str;
        }
    }
}