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;
const int N = 1e5 + 50, M = 2e6 + 50;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
char ori[4] = {'D', 'U', 'R', 'L'};
char ask(int ux, int uy, int vx, int vy) {
  for (int z = 0; z < 4; z++)
    if (ux + dx[z] == vx && uy + dy[z] == vy) return ori[z];
}
int n, m, a[N];
bool hv[N];
char c[N];
int b[N], ans;
int S, T;
int idx(int i, int j) { return (i - 1) * m + j; }
namespace G {
int fi[N], nxt[M], to[M], w[M], c[M], ec;
void clr() {
  memset(fi, 0, (T + 1) << 2);
  ec = 1;
}
void add(int x, int y, int z, int v) {
  nxt[++ec] = fi[x], fi[x] = ec, to[ec] = y, w[ec] = z, c[ec] = v;
  nxt[++ec] = fi[y], fi[y] = ec, to[ec] = x, w[ec] = 0, c[ec] = -v;
}
int d[N];
bool ex[N], vis[N];
bool spfa() {
  memset(ex, 0, sizeof(bool) * (T + 1));
  memset(d, 0x3f, (T + 1) << 2);
  queue<int> q;
  q.push(S);
  d[S] = 0;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    ex[x] = false;
    for (int e = fi[x], v; e; e = nxt[e])
      if (w[e] && d[v = to[e]] > d[x] + c[e]) {
        d[v] = d[x] + c[e];
        if (!ex[v]) ex[v] = true, q.push(v);
      }
  }
  return d[T] < 1e9;
}
int dfs(int u, int flw) {
  if (u == T) return ans += flw * d[T], flw;
  if (!flw) return flw;
  int sm = 0;
  vis[u] = true;
  for (int e = fi[u], v; e; e = nxt[e])
    if (d[v = to[e]] == d[u] + c[e] && w[e]) {
      if (vis[v]) continue;
      int dt = dfs(v, min(flw, w[e]));
      w[e] -= dt, w[e ^ 1] += dt;
      sm += dt, flw -= dt;
      if (!flw) break;
    }
  vis[u] = false;
  if (!sm) d[u] = 1e9;
  return sm;
}
}  // namespace G
void Main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &a[idx(i, j)]);
  if (n * m == 1) return puts("NO"), void();
  S = idx(n, m) + 1, T = S + 1;
  int ct = 0;
  G ::clr();
  for (int i = 1; i <= n * m; i++) c[i] = '\0', b[i] = hv[i] = 0;
  for (int i = 1, x, y; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      x = idx(i, j), hv[x] = true;
      for (int z = 0; z < 4; z++) {
        int tx = i + dx[z], ty = j + dy[z];
        if (tx < 1 || ty < 1 || tx > n || ty > m) continue;
        y = idx(tx, ty);
        if (a[x] == a[y] && ((i + j) & 1)) G ::add(x, y, 1, 0);
        if (a[y] < a[x]) hv[x] = false;
      }
      ct += hv[x];
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if ((i + j) & 1)
        G ::add(S, idx(i, j), 1, -hv[idx(i, j)]);
      else
        G ::add(idx(i, j), T, 1, -hv[idx(i, j)]);
  while (G ::spfa()) G ::dfs(S, 1e9);
  if (-ans < ct) return puts("NO"), void();
  puts("YES");
  for (int e = G ::fi[S], u; e; e = G ::nxt[e])
    if (G ::w[e ^ 1]) {
      u = G ::to[e];
      for (int o = G ::fi[u], v; o; o = G ::nxt[o])
        if (G ::w[o ^ 1]) {
          v = G ::to[o];
          int ux = (u - 1) / m + 1, uy = (u - 1) % m + 1;
          int vx = (v - 1) / m + 1, vy = (v - 1) % m + 1;
          c[u] = ask(ux, uy, vx, vy);
          c[v] = ask(vx, vy, ux, uy);
          b[u] = 1, b[v] = a[u] - 1;
        }
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1, x; j <= m; j++)
      if (c[x = idx(i, j)] == '\0') {
        x = idx(i, j);
        for (int z = 0, y; z < 4; z++) {
          int tx = i + dx[z], ty = j + dy[z];
          if (tx < 1 || ty < 1 || tx > n || ty > m) continue;
          y = idx(tx, ty);
          if (a[y] < a[x]) {
            b[x] = a[x] - a[y];
            c[x] = ori[z];
            break;
          }
        }
      }
  for (int i = 1; i <= n; i++, puts(""))
    for (int j = 1; j <= m; j++) cout << b[idx(i, j)] << " ";
  for (int i = 1; i <= n; i++, puts(""))
    for (int j = 1; j <= m; j++) cout << c[idx(i, j)] << " ";
}
int main() {
  int T;
  cin >> T;
  while (T--) Main();
  return 0;
}