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 <typename A, typename B, typename C>
struct triple {
  A X;
  B Y;
  C Z;
  triple(A a = 0, B b = 0, C c = 0) : X(a), Y(b), Z(c) {}
};
template <typename A, typename B, typename C>
triple<A, B, C> make_triple(A a = 0, B b = 0, C c = 0) {
  return triple<A, B, C>(a, b, c);
}
template <typename A, typename B, typename C>
bool operator<(const triple<A, B, C>& a, const triple<A, B, C>& b) {
  if (a.X != b.X) return a.X < b.X;
  if (a.Y != b.Y) return a.Y < b.Y;
  return a.Z < b.Z;
}
template <typename T, typename SS>
ostream& operator<<(ostream& ofs, const pair<T, SS>& p) {
  ofs << "( " << p.first << " , " << p.second << " )";
  return ofs;
}
template <typename T>
void print(T a) {
  for (auto i : a) cout << i << ' ';
  cout << '\n';
}
template <typename T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
template <typename T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
signed main() {
  srand(time(NULL));
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  auto solve = []() {
    long long n, d;
    cin >> n >> d;
    long long mx = n * (n - 1) / 2;
    long long addlvl = 1;
    long long mn = 0;
    long long dr = 0;
    long long cc = 0;
    while (cc + addlvl <= n) {
      cc += addlvl;
      mn += addlvl * dr;
      dr++;
      addlvl *= 2;
    }
    long long left = n - cc;
    mn += left * dr;
    if (mn > d || mx < d) return void(cout << "NO\n");
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) a[i] = i - 1;
    vector<long long> szz(n, 1);
    szz.back() = 0;
    vector<long long> dk(n);
    for (long long i = 0; i < (n); i++) dk[i] = i;
    vector<long long> bad(n);
    long long nw = n * (n - 1) / 2;
    while (nw > d) {
      long long v = -1;
      for (long long i = 0; i < (n); i++)
        if (!szz[i] && !bad[i] && (v == -1 || dk[v] > dk[i])) v = i;
      long long p = -1;
      for (long long i = 0; i < (n); i++)
        if (szz[i] < 2 && dk[i] < dk[v] - 1 && (p == -1 || dk[p] < dk[i]))
          p = i;
      if (p == -1) {
        bad[v] = 1;
        continue;
      }
      szz[a[v]]--;
      dk[v]--;
      szz[p]++;
      a[v] = p;
      nw--;
    }
    cout << "YES\n";
    for (long long i = 1; i < n; i++) cout << a[i] + 1 << ' ';
    cout << '\n';
  };
  long long t;
  cin >> t;
  for (long long _ = 0; _ < (t); _++) solve();
}