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>
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <typename T_container, typename T = typename enable_if<
                                    !is_same<T_container, string>::value,
                                    typename T_container::value_type>::type>
ostream &operator<<(ostream &os, const T_container &v) {
  os << '{';
  string sep;
  for (const T &x : v) os << sep << x, sep = ", ";
  return os << '}';
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
template <typename T>
void dbg_a(T *a, int l, int r) {
  cout << " {";
  for (int i = l; i < r; i++) cout << a[i] << ", ";
  cout << a[r] << "}" << endl;
}
template <typename T = int>
inline T read() {
  T f = 1, r = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    r = (r << 1) + (r << 3) + c - '0';
    c = getchar();
  }
  return f * r;
}
const int N = 5000 + 10, M = 2 * N + 10, INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int n, m, k;
int ans[N];
vector<int> node[N];
int mxdep, sdep, dep[N];
int d;
void solve() {
  n = read();
  d = read();
  for (int i = 0; i <= n; i++) node[i].clear();
  dep[1] = mxdep = sdep = 0;
  node[0].emplace_back(1);
  for (int i = 2; i <= n; i++) {
    dep[i] = dep[i >> 1] + 1;
    sdep += dep[i];
    mxdep = max(mxdep, dep[i]);
    node[dep[i]].emplace_back(i);
  }
  if (d > n * (n - 1) / 2 || sdep > d) {
    cout << "NO\n";
    return;
  }
  while (sdep < d) {
    for (int i = mxdep; i >= 1; i--) {
      if (node[i].size() >= 2 && node[i + 1].size() < node[i].size() * 2 - 2) {
        sdep++;
        mxdep = max(mxdep, i + 1);
        node[i + 1].emplace_back(node[i].back());
        node[i].pop_back();
        break;
      }
    }
  }
  for (int i = 0; i <= mxdep; i++) {
    for (int j = 0; j < node[i].size(); j++) {
      int l = j * 2, r = j * 2 + 1;
      if (l < node[i + 1].size()) ans[node[i + 1][l]] = node[i][j];
      if (r < node[i + 1].size()) ans[node[i + 1][r]] = node[i][j];
    }
  }
  cout << "YES\n";
  for (int i = 2; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << "\n";
}
signed main() {
  int T = 1;
  T = read();
  while (T--) solve();
  return 0;
}
