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;
struct Dinic {
  struct Edge {
    int to, rev;
    long long c, oc;
    long long flow() { return max(oc - c, 0LL); }
  };
  vector<int> lvl, ptr, q;
  vector<vector<Edge>> adj;
  Dinic(int n) : lvl(n), ptr(n), q(n), adj(n) {}
  void addEdge(int a, int b, long long c, int rcap = 0) {
    adj[a].push_back({b, (int)(adj[b]).size(), c, c});
    adj[b].push_back({a, (int)(adj[a]).size() - 1, rcap, rcap});
  }
  long long dfs(int v, int t, long long f) {
    if (v == t || !f) return f;
    for (int& i = ptr[v]; i < (int)(adj[v]).size(); i++) {
      Edge& e = adj[v][i];
      if (lvl[e.to] == lvl[v] + 1)
        if (long long p = dfs(e.to, t, min(f, e.c))) {
          e.c -= p, adj[e.to][e.rev].c += p;
          return p;
        }
    }
    return 0;
  }
  long long calc(int s, int t) {
    long long flow = 0;
    q[0] = s;
    for (int L = 0; L < (31); ++L) do {
        lvl = ptr = vector<int>((int)(q).size());
        int qi = 0, qe = lvl[s] = 1;
        while (qi < qe && !lvl[t]) {
          int v = q[qi++];
          for (auto& e : adj[v])
            if (!lvl[e.to] && e.c >> (30 - L))
              q[qe++] = e.to, lvl[e.to] = lvl[v] + 1;
        }
        while (long long p = dfs(s, t, LLONG_MAX)) flow += p;
      } while (lvl[t]);
    return flow;
  }
  bool leftOfMinCut(int a) { return lvl[a] != 0; }
};
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(n, vector<int>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      assert(a[i][j] >= 2);
    }
  }
  vector<vector<int>> need(n, vector<int>(m, 0));
  vector<int> dx = {1, 0, -1, 0};
  vector<int> dy = {0, 1, 0, -1};
  string dirs = "DRUL";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int foundless = 0;
      int foundeq = 0;
      for (int d = 0; d < 4; d++) {
        int ni = i + dx[d];
        int nj = j + dy[d];
        if (ni < 0 || nj < 0 || ni >= n || nj >= m) continue;
        if (a[ni][nj] < a[i][j]) foundless = 1;
        if (a[ni][nj] == a[i][j]) foundeq = 1;
      }
      if (!foundless) {
        if (!foundeq) {
          cout << "NO" << '\n';
          return;
        } else {
          need[i][j] = 1;
        }
      }
    }
  }
  Dinic flow(n * m + 4);
  int lc = 0, rc = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if ((i + j) & 1) {
        rc++;
        flow.addEdge(i * m + j, n * m + 1, 1);
        if (!need[i][j]) {
          flow.addEdge(n * m + 2, i * m + j, 1);
        }
      } else {
        lc++;
        flow.addEdge(n * m, i * m + j, 1);
        if (!need[i][j]) {
          flow.addEdge(i * m + j, n * m + 3, 1);
        }
        for (int d = 0; d < 4; d++) {
          int ni = i + dx[d];
          int nj = j + dy[d];
          if (ni < 0 || nj < 0 || ni >= n || nj >= m) continue;
          if (a[ni][nj] == a[i][j]) {
            flow.addEdge(i * m + j, ni * m + nj, 1);
          }
        }
      }
    }
  }
  flow.addEdge(n * m, n * m + 2, rc);
  flow.addEdge(n * m + 3, n * m + 1, lc);
  flow.addEdge(n * m + 2, n * m + 3, rc + lc);
  int ans = flow.calc(n * m, n * m + 1);
  if (ans != n * m) {
    cout << "NO" << '\n';
    return;
  }
  cout << "YES" << '\n';
  vector<vector<int>> score(n, vector<int>(m, 0));
  vector<vector<char>> pd(n, vector<char>(m, 'a'));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (auto e : flow.adj[i * m + j]) {
        if (e.to < n * m) {
          int fl = e.flow();
          assert(fl == 0 || fl == 1);
          if (fl == 1) {
            for (int d = 0; d < 4; d++) {
              int ni = i + dx[d];
              int nj = j + dy[d];
              if (ni < 0 || nj < 0 || ni >= n || nj >= m) continue;
              if (ni * m + nj == e.to) {
                pd[i][j] = dirs[d];
                pd[ni][nj] = dirs[(d + 2) % 4];
                score[i][j] = 1;
                score[ni][nj] = a[i][j] - 1;
              }
            }
          }
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (score[i][j] > 0) continue;
      for (int d = 0; d < 4; d++) {
        int ni = i + dx[d];
        int nj = j + dy[d];
        if (ni < 0 || nj < 0 || ni >= n || nj >= m) continue;
        if (a[ni][nj] < a[i][j]) {
          score[i][j] = a[i][j] - a[ni][nj];
          pd[i][j] = dirs[d];
        }
      }
      assert(score[i][j] > 0);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << score[i][j] << ' ';
    }
    cout << '\n';
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << pd[i][j] << ' ';
    }
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) solve();
}