Problem: Another dull quarantine day was going by when BThero decided to start researching matrices of size n × m. The rows are numerated 1 through n from top to bottom, and the columns are numerated 1 through m from left to right. The cell in the i-th row and j-th column is denoted as (i, j).

For each cell (i, j) BThero had two values: 

  1. The cost of the cell, which is a single positive integer. 
  2. The direction of the cell, which is one of characters L, R, D, U. Those characters correspond to transitions to adjacent cells (i, j - 1), (i, j + 1), (i + 1, j) or (i - 1, j), respectively. No transition pointed outside of the matrix. 



Let us call a cell (i_2, j_2) reachable from (i_1, j_1), if, starting from (i_1, j_1) and repeatedly moving to the adjacent cell according to our current direction, we will, sooner or later, visit (i_2, j_2). 

BThero decided to create another matrix from the existing two. For a cell (i, j), let us denote S_{i, j} as a set of all reachable cells from it (including (i, j) itself). Then, the value at the cell (i, j) in the new matrix will be equal to the sum of costs of all cells in S_{i, j}. 

After quickly computing the new matrix, BThero immediately sent it to his friends. However, he did not save any of the initial matrices! Help him to restore any two valid matrices, which produce the current one.

Input

The first line of input file contains a single integer T (1 ≤ T ≤ 100) denoting the number of test cases. The description of T test cases follows.

First line of a test case contains two integers n and m (1 ≤ n ⋅ m ≤ 10^5).

Each of the following n lines contain exactly m integers — the elements of the produced matrix. Each element belongs to the segment [2, 10^9].

It is guaranteed that ∑{(n ⋅ m)} over all test cases does not exceed 10^5.

Output

For each test case, if an answer does not exist, print a single word NO. Otherwise, print YES and both matrices in the same format as in the input.

  * The first matrix should be the cost matrix and the second matrix should be the direction matrix. 
  * All integers in the cost matrix should be positive. 
  * All characters in the direction matrix should be valid. No direction should point outside of the matrix. 

Example

Input


2
3 4
7 6 7 8
5 5 4 4
5 7 4 4
1 1
5


Output


YES
1 1 1 1
2 1 1 1
3 2 1 1
R D L L
D R D L
U L R U
NO

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int cx[4] = {0, 0, 1, -1};
int cy[4] = {-1, 1, 0, 0};
bool dfs(int v, int &T, vector<vector<int> > &g, vector<int> &vis,
         vector<int> &mt) {
  if (vis[v] == T) return false;
  vis[v] = T;
  for (auto u : g[v]) {
    if (mt[u] == -1 || dfs(mt[u], T, g, vis, mt)) {
      mt[u] = v;
      return true;
    }
  }
  return false;
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > A(n, vector<int>(m));
  vector<int> L, R;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> A[i][j];
      if ((i + j) % 2 == 0)
        L.push_back(i * m + j);
      else
        R.push_back(i * m + j);
    }
  }
  vector<int> bad(n * m, 1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < 4; k++) {
        int nx = i + cx[k], ny = j + cy[k];
        if (0 <= nx && nx < n && 0 <= ny && ny < m && A[nx][ny] < A[i][j])
          bad[i * m + j] = 0;
      }
    }
  }
  vector<vector<int> > g(n * m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < 4; k++) {
        int nx = i + cx[k], ny = j + cy[k];
        if (0 <= nx && nx < n && 0 <= ny && ny < m && A[nx][ny] == A[i][j])
          g[i * m + j].push_back(nx * m + ny);
      }
    }
  }
  int ok = 1, T = 1;
  vector<int> vis(n * m), mt(n * m);
  auto pairing = [&](vector<int> L, vector<int> R) {
    vector<int> use(n * m);
    for (auto v : R) use[v] = 1, mt[v] = -1;
    for (auto v : L) {
      vector<int> act;
      for (auto u : g[v])
        if (use[u]) act.push_back(u);
      g[v] = act;
    }
    sort((L).begin(), (L).end(), [&](int v, int u) { return bad[v] > bad[u]; });
    vector<int> res;
    for (auto v : L) {
      if (dfs(v, T, g, vis, mt))
        res.push_back(v);
      else if (bad[v])
        ok = 0;
      T++;
    }
    return res;
  };
  vector<int> x = pairing(L, R);
  vector<int> y = pairing(R, x);
  if (!ok)
    cout << "NO\n";
  else {
    cout << "YES\n";
    string D = "LRDU";
    vector<string> dir(n, string(m, '.'));
    vector<vector<int> > num(n, vector<int>(m));
    for (auto f : x) {
      int t = mt[f];
      if (t == f - 1) dir[f / m][f % m] = 'L', dir[t / m][t % m] = 'R';
      if (t == f + 1) dir[f / m][f % m] = 'R', dir[t / m][t % m] = 'L';
      if (t == f - m) dir[f / m][f % m] = 'U', dir[t / m][t % m] = 'D';
      if (t == f + m) dir[f / m][f % m] = 'D', dir[t / m][t % m] = 'U';
      assert(A[f / m][f % m] == A[t / m][t % m]);
      num[f / m][f % m] = A[f / m][f % m] - 1;
      num[t / m][t % m] = 1;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (num[i][j] == 0) {
          assert(bad[i * m + j] == 0);
          for (int k = 0; k < 4; k++) {
            int nx = i + cx[k], ny = j + cy[k];
            if (0 <= nx && nx < n && 0 <= ny && ny < m && A[nx][ny] < A[i][j])
              num[i][j] = A[i][j] - A[nx][ny], dir[i][j] = D[k];
          }
        }
        cout << num[i][j] << " \n"[j + 1 == m];
      }
    }
    cout << "\n";
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cout << dir[i][j] << " \n"[j + 1 == m];
      }
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}