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;
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(long long &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const long long &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T, class U>
void _W(const pair<T, U> &x) {
  _W(x.first);
  putchar(' ');
  _W(x.second);
}
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
int MOD = 1e9 + 7;
void ADD(long long &x, long long v) {
  x = (x + v) % MOD;
  if (x < 0) x += MOD;
}
const int SIZE = 1e6 + 10;
vector<int> lv[5001];
int an[5001];
void solve() {
  int n, d;
  R(n, d);
  if (d > n * (n - 1) / 2) {
    W("NO");
    return;
  }
  int least = 0;
  int h = 0;
  for (int i = 2; i <= n; i++) {
    if (!(i & (i - 1))) h++;
    least += h;
  }
  if (least > d) {
    W("NO");
    return;
  }
  W("YES");
  int now = n * (n - 1) / 2;
  int now_lv = 1;
  lv[0].push_back(1);
  lv[1].push_back(2);
  for (int i = n; i > now_lv + 1; i--) {
    if (now == d) {
      lv[i - 1].push_back(i);
      continue;
    }
    int v = min(now - d, i - 1 - now_lv);
    now -= v;
    lv[i - 1 - v].push_back(i);
    if (((int)(lv[now_lv]).size()) == (1 << now_lv)) {
      now_lv++;
      if (now_lv + 1 < i) lv[now_lv].push_back(now_lv + 1);
    }
  }
  for (int i = 1; ((int)(lv[i]).size()); i++) {
    for (int j = 0; j < (((int)(lv[i]).size())); ++j) {
      an[lv[i][j]] = lv[i - 1][j / 2];
    }
  }
  W(vector<int>(an + 2, an + n + 1));
  for (int i = 0; ((int)(lv[i]).size()); i++) {
    lv[i].clear();
  }
}
int main() {
  int ___T;
  scanf("%d", &___T);
  for (int cs = 1; cs <= ___T; cs++) {
    solve();
  }
  return 0;
}