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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
void fastIO() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
template <typename T, typename U>
inline void mnze(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void mxze(T &x, U y) {
  if (x < y) x = y;
}
void _scan(int &x) { scanf("%d", &x); }
void _scan(long long &x) { scanf("%lld", &x); }
void _scan(double &x) { scanf("%lf", &x); }
void _scan(char &x) { scanf(" %c", &x); }
void _scan(char *x) { scanf("%s", x); }
template <typename T>
void _scan(vector<T> &v) {
  for (int i = 0; i < (int)v.size(); i++) _scan(v[i]);
}
void scan() {}
template <typename T, typename... U>
void scan(T &head, U &...tail) {
  _scan(head);
  scan(tail...);
}
template <typename T>
void _dbg(const char *sdbg, T h) {
  cerr << sdbg << "=" << h << "\n";
}
template <typename T, typename... U>
void _dbg(const char *sdbg, T h, U... t) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << "=" << h << ",";
  _dbg(sdbg + 1, t...);
}
long long MOD = 1e9 + 7;
inline long long Msum(long long x) { return x; }
template <typename... Rest>
inline long long Msum(long long x, Rest... rest) {
  return (x + Msum(rest...)) % MOD;
}
inline long long Mprod(long long x) { return x; }
template <typename... Rest>
inline long long Mprod(long long x, Rest... rest) {
  return x * Mprod(rest...) % MOD;
}
inline long long Mnorm(long long x) { return (x % MOD + MOD) % MOD; }
const int MAXN = 5e3 + 3;
int p[MAXN];
int dd[MAXN];
int sum(int l, int r) { return (r + l) * (r - l + 1) / 2; }
int main() {
  int TC;
  scan(TC);
  while (TC--) {
    int n, D;
    scan(n, D);
    for (int i = 0; i <= n; i++) dd[i] = 0;
    int d = 0;
    dd[1] = 0;
    queue<int> q;
    q.push(1);
    q.push(1);
    for (int v = 2; v <= n && d < D; v++) {
      int u = q.front();
      q.pop();
      p[v] = u;
      dd[v] = dd[u] + 1;
      d += dd[v];
      q.push(v);
      q.push(v);
      int x = n - v;
      if (x && d + sum(dd[v] + 1, dd[v] + x) == D) {
        for (int w = v + 1; w <= n; w++) {
          p[w] = w - 1;
          dd[w] = dd[w - 1] + 1;
          d += dd[w];
        }
        assert(D == d);
        break;
      }
      if (x > 1 && d + sum(dd[v] + 1, dd[v] + x - 1) <= D &&
          d + sum(dd[v] + 1, dd[v] + x - 1) + (dd[v] + x - 1) >= D) {
        int nd = d + sum(dd[v] + 1, dd[v] + x - 1);
        int dn = D - nd;
        if (dn > dd[v] && dn <= dd[v] + x - 1) {
          for (int w = v + 1; w < n; w++) {
            p[w] = w - 1;
            dd[w] = dd[w - 1] + 1;
            d += dd[w];
            if (dd[w] == dn) {
              p[n] = p[w];
              dd[n] = dd[w];
              d += dd[n];
            }
          }
          assert(p[n] != 0);
          assert(D == d);
          break;
        }
      }
    }
    if (d != D || (d == D && dd[n] == 0)) {
      printf("NO\n");
      continue;
    }
    printf("YES\n");
    for (int i = 2; i <= n; i++) printf("%d ", p[i]);
    printf("\n");
  }
}