Problem: There are n lanterns in a row. The lantern i is placed in position i and has power equal to p_i.

Each lantern can be directed to illuminate either some lanterns to the left or some lanterns to the right. If the i-th lantern is turned to the left, it illuminates all such lanterns j that j ∈ [i - p_i, i - 1]. Similarly, if it is turned to the right, it illuminates all such lanterns j that j ∈ [i + 1, i + p_i].

Your goal is to choose a direction for each lantern so each lantern is illuminated by at least one other lantern, or report that it is impossible.

Input

The first line contains one integer t (1 ≤ t ≤ 10000) — the number of test cases.

Each test case consists of two lines. The first line contains one integer n (2 ≤ n ≤ 3 ⋅ 10^5) — the number of lanterns.

The second line contains n integers p_1, p_2, ..., p_n (0 ≤ p_i ≤ n) — the power of the i-th lantern.

The sum of n over all test cases does not exceed 3 ⋅ 10^5.

Output

For each test case, print the answer as follows:

If it is possible to direct all lanterns so that each lantern is illuminated, print YES in the first line and a string of n characters L and/or R (the i-th character is L if the i-th lantern is turned to the left, otherwise this character is R) in the second line. If there are multiple answers, you may print any of them.

If there is no answer, simply print NO for that test case.

Example

Input


4
8
0 0 3 1 1 1 1 2
2
1 1
2
2 2
2
0 1


Output


YES
RRLLLLRL
YES
RL
YES
RL
NO

Solution (in CPP):

Solution:
#include <cassert>
#include <iostream>
#include <limits>
#include <vector>

using VI = std::vector<int>;
using VVI = std::vector<VI>;
using uint = unsigned;

struct Sparse {
  VVI arr;
  VI src;

  // does not initialize, just sets  src.size()
  Sparse(int n)
    :arr {},
     src { VI(n) }
  {}

  int best(int p, int q) const {
    return src[p] >= src[q] ? p : q;
  }

  static constexpr uint bitFloor(int x) {
    return ((-1u >> __builtin_clz(x)) + 1u) >> 1;
  }

  // index query
  int iquery(int L, int R) const {
    assert(L < R);
    uint p2 = bitFloor(R - L);
    int k = __builtin_ctz(p2);
    return best(arr[k][L], arr[k][R-p2]);
  }

  // value query
  int vquery(int L, int R) const {
    return L >= R ? std::numeric_limits<int>::min() : src[iquery(L, R)];
  }

  void initialize() {
    arr.clear();
    arr.reserve(__builtin_ctz(bitFloor(int(src.size()))) + 1);
    arr.emplace_back(VI(src.size()));
    for (int i = 0; i < int(src.size()); ++i)
      arr[0][i] = i;
    for (int step = 1;; step <<= 1) {
      VI& prev = arr.back();
      int maxi = int(prev.size()) - step;
      if (maxi < 0)
        break;
      arr.emplace_back(maxi);
      VI& curr = arr.back();
      for (int i = 0; i < maxi; ++i)
        curr[i] = best(prev[i], prev[i+step]);
    }

    //verify();
  }

  void verify() const {
    int n = int(src.size());
    for (int i = 0; i <= n; ++i)
      for (int j = 0; j <= n; ++j) {
        int ans = std::numeric_limits<int>::min();
        for (int k = i; k < j; ++k)
          ans = std::max(ans, src[k]);
        assert(ans == vquery(i, j));
        if (i < j) {
          int r = iquery(i, j);
          assert(0 <= r);
          assert(r < n);
          assert(src[r] == ans);
          for (int k = i; k < r; ++k)
            assert(src[k] < ans);
        }
      }
    return;
  }
};

struct SegTree {
  int n;
  VI arr;

  SegTree(const VI& v)
    :n { int(v.size()) },
     arr { VI(2*v.size()) }
  {
    for (int i = 0; i < n; ++i)
      arr[n+i] = v[i];
    for (int i = n-1; i >= 0; --i)
      arr[i] = std::max(arr[2*i], arr[2*i+1]);
  }

  int query(int L, int R) const {
    L += n;
    R += n;
    int ans = std::numeric_limits<int>::min();
    while (L < R) {
      ans = std::max(ans, std::max(arr[L], arr[R-1]));
      L = (L + 1) >> 1;
      R >>= 1;
    }
    return ans;
  }

  void set(int ix, int val) {
    ix += n;
    arr[ix] = val;
    while (ix >>= 1)
      arr[ix] = std::max(arr[2*ix], arr[2*ix+1]);
    return;
  }
};

int main() {
  using namespace std;
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    VI p = VI(n);
    for (int& pi : p)
      cin >> pi;
    Sparse direct { n };
    for (int i = 0; i < n; ++i)
      direct.src[i] = min(n, i + p[i] + 1);
    direct.initialize();

    Sparse indirect { n };
    {
      SegTree indirectSegTree { direct.src };
      for (int i = n-1; i >= 0; --i) {
        int indOpts = indirectSegTree.query(i+1, direct.src[i]);
        indirectSegTree.set(i, max(direct.src[i], indOpts));
      }
      for(int i = 0; i < n; ++i)
        indirect.src[i] = indirectSegTree.query(i, i+1);
      indirect.initialize();
    }

    Sparse negLeftReach { n };
    for (int i = 0; i < n; ++i)
      negLeftReach.src[i] = p[i] - i;
    negLeftReach.initialize();

    struct DP_Entry {
      int nextLeftFacing;
      int reaches;
    };
    vector<DP_Entry> dpL = vector<DP_Entry>(n+1, DP_Entry { -1, -1 });
    vector<DP_Entry> dpR = vector<DP_Entry>(n+1, DP_Entry { -1, -1 });
    dpL[n] = dpR[n] = DP_Entry { n, -1 };
    // Can lanterns [i, n) light themselves if lamp i points in direction X?
    // If no: dpX[i] is DP_Entry { -1, -1 }.
    // If yes: dpX[i] has the leftmost lamp in  pointed left in some
      // valid configuration on [i+1, n), and the next dp entry to consult
    for (int i = n-1; i >= 0; --i) {
      int nextStart = i+1;

      // (nextStart - i) must at least double every 3 iterations, so this
      // while loop runs O(log n) times for each value of i
      while (negLeftReach.vquery(nextStart, n) >= -i) {
        // while(some j in [nextStart, n) can reach i by pointing left)
        int j = nextStart;
        { int jR = n-1; // binary search, find leftmost such j
          while (j < jR) {
            int M = (j + jR) >> 1;
            int w = negLeftReach.iquery(nextStart, M+1);
            if (negLeftReach.src[w] >= -i)
              jR = w; // w <= M
            else
              j = M + 1;
          }
        }

        assert(j < n);
        int kL = direct.vquery(i+1, j);
        if (j == i+1)
          kL = j;
        else {
          assert(kL >= j);
          assert(kL <= n);
          if (kL > j + 1)
            kL = indirect.vquery(j+1, kL);
          assert(kL >= j);
          assert(kL <= n);
        }
        bool okL = ((kL == j) ? dpL[kL] : dpR[kL]).nextLeftFacing >= 0;
        if (okL) {
          // dpR[i] == dpL[i] if the latter is OK; this is used later
          dpL[i] = dpR[i] = DP_Entry { j, kL };
          break;
        }
        if (kL > j && direct.iquery(i+1, kL) != j)
          nextStart = kL;
        else
          nextStart = j+1;
        int kR = direct.vquery(i, j); // i vs i+1: Is i facing right?
        assert(kR >= j);
        assert(kR <= n);
        if (kR > j + 1)
          kR = indirect.vquery(j+1, kR);
        assert(kR >= j);
        assert(kR <= n);
        bool okR = ((kR == j) ? dpL[kR] : dpR[kR]).nextLeftFacing >= 0;
        if (okR)
          dpR[i] = DP_Entry { j, kR };
      }
    } // dpL and dpR calculated

    if (dpR[0].nextLeftFacing < 0)
      cout << "NO\n";
    else {
      string out = string(n, 'R');
      // since dpR[i] = dpL[i] if the latter is an
      // OK state, only use the former to step
      for (int currStop = 0; currStop < n; currStop = dpR[currStop].reaches)
        out[dpR[currStop].nextLeftFacing] = 'L';
      cout << "YES\n" << out << '\n';
    }
  }

  return 0;
}