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;
long long int n, m;
long long int arr[300000];
long long int par[6000];
long long int dep[6000];
long long int cou[6000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int TESTS, q, a, s, b, r, l, k, c, p, h, w, d, x, y, z, xs, ys, t;
  TESTS = 1;
  cin >> TESTS;
  while (TESTS--) {
    cin >> n >> d;
    long long int maxi = n * (n - 1) / 2;
    long long int mini = 0;
    x = n - 1;
    long long int cur = 2;
    w = 1;
    while (x > 0) {
      mini += w * min(x, cur);
      x -= cur;
      w++;
      cur *= 2;
    }
    if (d < mini || d > maxi) {
      cout << "NO\n";
      continue;
    }
    if (n == 2) {
      cout << "YES\n";
      cout << "1 2\n";
      continue;
    }
    par[0] = dep[0] = 0;
    for (long long int i = 1; i <= n - 1; i++) {
      par[i] = i - 1;
      dep[i] = dep[i - 1] + 1;
    }
    for (long long int i = 0; i <= n - 2; i++) cou[i] = 1;
    cou[n - 1] = 0;
    cur = maxi;
    long long int chil = n - 2;
    for (long long int i = 2; i <= n - 1; i++) {
      long long int alow = 1e15;
      long long int ind = -1;
      for (long long int j = 0; j <= par[i]; j++)
        if (alow > dep[j] && dep[j] < dep[par[i]] && cou[j] < 2 &&
            cur - (dep[par[i]] - dep[j]) * chil >= d) {
          alow = dep[j];
          ind = j;
        }
      if (ind != -1) {
        cur -= (dep[par[i]] - alow) * chil;
        cou[par[i]]--;
        cou[ind]++;
        par[i] = ind;
        dep[i] = dep[ind] + 1;
        for (long long int j = i + 1; j <= n - 1; j++) dep[j] = dep[j - 1] + 1;
      }
      chil--;
    }
    cout << "YES\n";
    for (long long int i = 1; i <= n - 1; i++) cout << par[i] + 1 << " ";
    cout << "\n";
  }
  return 0;
}