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.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
    private static FastScanner input;
    private static PrintWriter output;

    private static Node[] nodes;

    public static void main(String[] args) {
//        openFile();
      openConsole();
        int numTest = readInt();
        for (int eachTest = 0; eachTest < numTest; eachTest++) {
            int n = readInt();
            int d = readInt();
            solve(n, d);
        }
        closeReader();
    }

    private static void solve(int n, int d) {
        if (minH(n) > d || maxH(n) < d) {
            output.println("NO");
            return;
        }
        StringBuilder sb = new StringBuilder();
        output.println("YES");
        nodes = new Node[n + 1];
        build(1, n, d);
        for (int i = 2; i <= n; i++) {
            sb.append(nodes[i].parent.id).append(' ');
        }
        output.println(sb.toString());
    }

    static class Node {
        int id;
        Node parent;
    }

    public static Node build(int l, int r, int d) {
        if (l > r) {
            return null;
        }

        Node root = new Node();
        root.id = l;
        nodes[root.id] = root;
        d -= (r - l + 1) - 1;
        for (int i = l; i <= r; i++) {
            int left = (i - (l + 1) + 1);
            int right = r - i;
            if (minH(left) + minH(right) <= d &&
                maxH(left) + maxH(right) >= d) {
                int leftAlloc = Math.max(minH(left), d - maxH(right));
                Node leftChild = build(l + 1, i, leftAlloc);
                Node rightChild = build(i + 1, r, d - leftAlloc);
                if (leftChild != null) {
                    leftChild.parent = root;
                }
                if (rightChild != null) {
                    rightChild.parent = root;
                }
                break;
            }
        }
        return root;
    }

    private static int minH(int n) {
        int remaining = n;
        int sum = 0;
        for (int level = 0; remaining > 0; level++) {
            int numNodes = Math.min(remaining, 1 << level);
            remaining -= numNodes;
            sum += numNodes * level;
        }
        return sum;
    }

    private static int maxH(int n) {
        return n * (n - 1) / 2;
    }

    private static void solve_F() {
        int size = readInt();
        List<Pair> data = new ArrayList<>();
        int[] positions = new int[size];
        int[] velocity = new int[size];

        for (int i = 0; i < size; i++) {
            positions[i] = readInt();
        }

        for (int i = 0; i < size; i++) {
            velocity[i] = readInt();
            data.add(new Pair(positions[i], velocity[i]));
        }

        solve(data);
    }

    public static long solve(List<Pair> points) {
        FenwickTree countTree = new FenwickTree(points.size());
        FenwickTree valueTree = new FenwickTree(points.size());

        TreeSet<Integer> velocity = new TreeSet<>();
        for (Pair eachData : points) {
            velocity.add(eachData.velocity);
        }

        TreeMap<Integer, Integer> velocityToIndex = new TreeMap<>();
        for (Integer eachVelocity : velocity) {
            velocityToIndex.put(eachVelocity, velocityToIndex.size() + 1);
        }

        points.sort(Comparator.comparingInt(a -> a.position));

        long sum = 0;
        for (Pair eachPoint : points) {
            int velocityOrder = velocityToIndex.get(eachPoint.velocity);
            if (velocityOrder > 0) {
                long count = countTree.rangeSumQuery(velocityOrder);
                long value = valueTree.rangeSumQuery(velocityOrder);
                sum += eachPoint.position * count - value;
            }
            countTree.addValue(velocityOrder, 1);
            valueTree.addValue(velocityOrder, eachPoint.position);
            System.out.println(sum);
        }
        return sum;
    }

    static class FenwickTree { // one-based DS
        private final int n;
        private final long[] ft;

        private FenwickTree(int size) {
            n = size;
            ft = new long[n + 1];
        }

        // O(log n)
        long rangeSumQuery(int b) {
            long sum = 0;
            while (b > 0) {
                sum += ft[b];
                b -= b & -b;
            } // min?
            return sum;
        }

        long rangeSumQuery(int a, int b) {
            return rangeSumQuery(b) - rangeSumQuery(a - 1);
        }

        // O(log n), update = increment
        void addValue(int k, int val) {
            while (k <= n) {
                ft[k] += val;
                k += k & -k;
            } // min?
        }

        // c * O(log n), c < 1
        long point_query(int idx) {
            long sum = ft[idx];
            if (idx > 0) {
                int z = idx ^ (idx & -idx);
                --idx;
                while (idx != z) {
                    sum -= ft[idx];
                    idx ^= idx & -idx;
                }
            }
            return sum;
        }
    }

    static class Pair {
        int position, velocity;

        public Pair(int aPosition, int aVelocity) {
            position = aPosition;
            velocity = aVelocity;
        }
    }

    private static long readLong() {
        return input.nextLong();
    }

    private static String readString() {
        return input.nextLine();
    }

    private static int readInt() {
        return input.nextInt();
    }

    private static int[] readIntArray(int size) {
        int[] data = new int[size];
        for (int i = 0; i < size; i++) {
            data[i] = readInt();
        }
        return data;
    }

    private static void openConsole() {
        input = new FastScanner(System.in);
        output = new PrintWriter(System.out);
    }

    private static void openFile() {
        ClassLoader classLoader = Main.class.getClassLoader();
        File myFile = new File(classLoader.getResource("input.txt").getFile());
        try {
            input = new FastScanner(new FileInputStream(myFile));
        } catch (FileNotFoundException aE) {
            throw new IllegalStateException("Failed to open input file");
        }
        output = new PrintWriter(System.out);
    }

    private static void closeReader() {
        output.flush();
        output.close();
    }

    private static class FastScanner {
        private StringTokenizer st;
        private final BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        private String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException aE) {
                    throw new IllegalStateException("Failed on tokenizer");
                }
            }
            return st.nextToken();
        }

        boolean hasNext() {
            try {
                return br.ready() || (st != null && st.hasMoreTokens());
            } catch (IOException aE) {
                throw new IllegalStateException("Failed on hasNext()");
            }
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException aE) {
                throw new IllegalStateException("Failed on nextLine()");
            }
        }

        boolean hasNextLine() {
            try {
                return br.ready();
            } catch (IOException aE) {
                throw new IllegalStateException("Failed on hasNextLine()");
            }
        }
    }
}