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>
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        EConstructTheBinaryTree solver = new EConstructTheBinaryTree();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class EConstructTheBinaryTree {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int n = s.nextInt(), d = s.nextInt(), cur = n * (n - 1) >> 1, mn = 0;
            for (int i = 1, lvl = 0; i <= n; i++) {
                mn += lvl;
                if ((i & (i + 1)) == 0) lvl++;
            }
            if (d > cur || d < mn) {
                w.println("NO");
                return;
            }
            int[] par = new int[n], lvl = new int[n], cnt = new int[n];
            boolean[] can = new boolean[n];
            Arrays.fill(can, true);
            for (int i = 0; i < n; i++) {
                par[i] = i - 1;
                lvl[i] = i;
                cnt[i] = 1;
            }
            cnt[n - 1] = 0;
            while (cur > d) {
                int leaf = -1;
                for (int i = 0; i < n; i++)
                    if (can[i] && cnt[i] == 0 && (leaf == -1 || lvl[leaf] > lvl[i]))
                        leaf = i;
                int newPar = -1;
                for (int i = 0; i < n; i++)
                    if (cnt[i] < 2 && lvl[i] < lvl[leaf] - 1 && (newPar == -1 || lvl[newPar] < lvl[i]))
                        newPar = i;
                if (newPar == -1) {
                    can[leaf] = false;
                    continue;
                }
                cnt[par[leaf]]--;
                cnt[newPar]++;
                lvl[leaf]--;
                par[leaf] = newPar;
                cur--;
            }
            w.println("YES");
            for (int i = 1; i < n; i++) w.print(++par[i] + " ");
            w.println();
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

