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;
using ll = long long;
using ld = long double;
namespace io {
template <class T>
void re(complex<T>& x);
template <class T1, class T2>
void re(pair<T1, T2>& p);
template <class T>
void re(vector<T>& a);
template <class T, size_t SZ>
void re(array<T, SZ>& a);
template <class T>
void re(T& x) {
  cin >> x;
}
void re(double& x) {
  string t;
  re(t);
  x = stod(t);
}
void re(ld& x) {
  string t;
  re(t);
  x = stold(t);
}
template <class T, class... Ts>
void re(T& t, Ts&... ts) {
  re(t);
  re(ts...);
}
template <class T>
void re(complex<T>& x) {
  T a, b;
  re(a, b);
  x = {a, b};
}
template <class T1, class T2>
void re(pair<T1, T2>& p) {
  re(p.first, p.second);
}
template <class T>
void re(vector<T>& a) {
  for (int i = (0) - (1 - 2 * (0 > ((int)a.size())) < 0);
       (1 - 2 * (0 > ((int)a.size()))) > 0 ? i < (((int)a.size()))
                                           : i >= (((int)a.size()));
       i += (1 - 2 * (0 > ((int)a.size()))))
    re(a[i]);
}
template <class T, size_t SZ>
void re(array<T, SZ>& a) {
  for (int i = (0) - (1 - 2 * (0 > SZ) < 0);
       (1 - 2 * (0 > SZ)) > 0 ? i < (SZ) : i >= (SZ); i += (1 - 2 * (0 > SZ)))
    re(a[i]);
}
void pr(int x) { cout << x; }
void pr(long x) { cout << x; }
void pr(ll x) { cout << x; }
void pr(unsigned x) { cout << x; }
void pr(unsigned long x) { cout << x; }
void pr(unsigned long long x) { cout << x; }
void pr(float x) { cout << x; }
void pr(double x) { cout << x; }
void pr(ld x) { cout << x; }
void pr(char x) { cout << x; }
void pr(const char* x) { cout << x; }
void pr(const string& x) { cout << x; }
void pr(bool x) { pr(x ? "true" : "false"); }
template <class T>
void pr(const complex<T>& x) {
  cout << x;
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x);
template <class T>
void pr(const T& x);
template <class T, class... Ts>
void pr(const T& t, const Ts&... ts) {
  pr(t);
  pr(ts...);
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x) {
  pr("{", x.first, ", ", x.second, "}");
}
template <class T>
void pr(const T& x) {
  pr("{");
  bool fst = 1;
  for (const auto& a : x) pr(!fst ? ", " : "", a), fst = 0;
  pr("}");
}
void ps() { pr("\n"); }
template <class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) pr(" ");
  ps(ts...);
}
void pc() { pr("]\n"); }
template <class T, class... Ts>
void pc(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) pr(", ");
  pc(ts...);
}
}  // namespace io
using namespace io;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const ll INF = 1e18;
const int inf = 1e9;
const ld PI = acos(-1.0);
const int N = 5003;
int low[N], high[N];
int calculate_low(int n) {
  if (n <= 1) return 0;
  if (low[n]) return low[n];
  int x = n / 2;
  int y = n - x - 1;
  return low[n] = x + y + calculate_low(x) + calculate_low(y);
}
int calculate_high(int n) { return n * (n - 1) / 2; }
void prep() {
  for (int i = 2; i < N; i++) {
    low[i] = calculate_low(i);
    high[i] = calculate_high(i);
  }
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int random(int l = 0, int r = MOD) { return l + (rng()) % (r - l + 1); }
vector<int> parent(N);
int cnt = 1;
void prune(int u, int n, int d) {
  if (n <= 1) return;
  int x = 0, y = 0, dx, dy;
  while (1) {
    x = random(0, n - 1);
    dx = random(low[x], high[x]);
    y = n - 1 - x;
    dy = d - (n - 1) - dx;
    if (low[y] <= dy && dy <= high[y]) break;
  }
  if (x != 0) {
    int cur = cnt;
    parent[cur] = u;
    cnt++;
    prune(cur, x, dx);
  }
  if (y != 0) {
    int cur = cnt;
    parent[cur] = u;
    cnt++;
    prune(cnt - 1, y, dy);
  }
};
void solve() {
  int n, d;
  cin >> n >> d;
  if (low[n] > d || d > high[n]) {
    cout << "NO\n";
    return;
  }
  cout << "YES\n";
  cnt = 1;
  prune(0, n, d);
  for (int i = 1; i < n; i++) {
    cout << parent[i] + 1 << ' ';
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  prep();
  int _;
  cin >> _;
  while (_--) solve();
}