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 T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi) {
    if (vi != v.begin()) os << ", ";
    os << *vi;
  }
  os << "}";
  return os;
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  os << '(' << p.first << ", " << p.second << ')';
  return os;
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
int compute_maximum(int n) { return n * (n - 1) / 2; }
int compute_minimum(int n) {
  int sum = 0;
  for (int depth = 0; 1 << depth <= n; depth++) {
    int count = min(n - (1 << depth) + 1, 1 << depth);
    sum += count * depth;
  }
  return sum;
}
bool in_range(int x, int low, int high) { return low <= x && x <= high; }
bool possible(int n, int d) {
  return in_range(d, compute_minimum(n), compute_maximum(n));
}
vector<int> P;
void construct(int n, int d, int root, int parent) {
  ;
  if (n <= 0) return;
  assert(possible(n, d));
  P[root] = parent;
  for (int left = 0; left <= n / 2; left++) {
    int right = n - 1 - left;
    int left_min = left + compute_minimum(left),
        left_max = left + compute_maximum(left);
    int right_min = right + compute_minimum(right),
        right_max = right + compute_maximum(right);
    int LD = -1, RD = -1;
    if (in_range(d - left_min, right_min, right_max)) {
      LD = left_min;
      RD = d - LD;
    } else if (in_range(d - left_max, right_min, right_max)) {
      LD = left_max;
      RD = d - LD;
    } else if (in_range(d - right_min, left_min, left_max)) {
      RD = right_min;
      LD = d - RD;
    } else if (in_range(d - right_max, left_min, left_max)) {
      RD = right_max;
      LD = d - RD;
    }
    if (LD >= 0) {
      construct(left, LD - left, root + 1, root);
      construct(right, RD - right, root + left + 1, root);
      return;
    }
  }
  assert(false);
}
void run_case() {
  int N, D;
  cin >> N >> D;
  if (!possible(N, D)) {
    cout << "NO" << '\n';
    return;
  }
  P.assign(N + 1, -1);
  construct(N, D, 1, -1);
  cout << "YES" << '\n';
  for (int i = 2; i <= N; i++) cout << P[i] << (i < N ? ' ' : '\n');
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int tests;
  cin >> tests;
  while (tests-- > 0) run_case();
}