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;
namespace F {
enum { N = 2000000, M };
int f, g, e = 1, S, T, hd[N], C[N], Q[N], nt[M], to[M], F[M], D[N], G[N], O[M];
void add(int x, int y, int z) {
  if (!z) return;
  nt[++e] = hd[x], hd[x] = e, to[e] = y, F[e] = z;
  nt[++e] = hd[y], hd[y] = e, to[e] = x, F[e] = 0;
}
void add(int x, int y, int a, int b) {
  add(x, y, b - a);
  G[x] -= a, G[y] += a;
}
bool cook() {
  for (int i = 1; i <= T; ++i) D[i] = 0, C[i] = hd[i];
  int t = 1;
  Q[1] = S, D[S] = 1;
  for (int h = 1; h <= t; ++h) {
    int u = Q[h];
    for (int e = hd[u]; e; e = nt[e]) {
      int v = to[e];
      if (F[e] && !D[v]) {
        D[v] = D[u] + 1;
        Q[++t] = v;
      }
    }
  }
  return D[T];
}
int eat(int u, int f) {
  if (u == T || !f) return f;
  int r = 0;
  for (int &e = C[u]; e; e = nt[e]) {
    int v = to[e], x;
    if (D[v] == D[u] + 1 && (x = eat(v, min(f, F[e])))) {
      F[e] -= x, r += x;
      F[e ^ 1] += x, f -= x;
    }
    if (!f) break;
  }
  return r;
}
bool go(int n) {
  S = n + 1, T = n + 2, f = g = 0;
  for (int i = 1; i <= n; ++i) {
    if (G[i] > 0) add(S, i, G[i]), g += G[i];
    if (G[i] < 0) add(i, T, -G[i]);
  }
  while (cook()) f += eat(S, 1 << 30);
  for (int i = 1; i <= T; ++i) hd[i] = G[i] = 0;
  e = 1;
  return f == g;
}
}  // namespace F
int n, m;
const int U[] = {1, 0, -1, 0}, V[] = {0, -1, 0, 1};
void magic() {
  scanf("%d%d", &n, &m);
  int X[n + 2][m + 2], I[n + 2][m + 2], c = 0;
  char C[n + 2][m + 2];
  int D[n + 2][m + 2];
  memset(I, 0, sizeof I);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      scanf("%d", &X[i][j]);
      I[i][j] = ++c;
    }
  struct O {
    int x, y, d, e;
  } L[c * 4];
  int l = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      int o = 1;
      for (int d = 0; d <= 3; ++d) {
        int x = i + U[d], y = j + V[d];
        if (I[x][y] && X[i][j] == X[x][y] && ((i + j) & 1))
          F::add(I[i][j], I[x][y], 0, 1), L[++l] = (O){i, j, d, F::e};
        if (I[x][y] && X[i][j] > X[x][y])
          o = 0, C[i][j] = "DLUR"[d], D[i][j] = X[i][j] - X[x][y];
      }
      if (o) {
        if ((i + j) & 1)
          F::add(c + 1, I[i][j], 1, 1);
        else
          F::add(I[i][j], c + 1, 1, 1);
      } else {
        if ((i + j) & 1)
          F::add(c + 1, I[i][j], 0, 1);
        else
          F::add(I[i][j], c + 1, 0, 1);
      }
    }
  if (!F::go(c + 1)) {
    puts("NO");
    return;
  }
  puts("YES");
  for (int i = 1; i <= l; ++i)
    if (F::F[L[i].e]) {
      int x = L[i].x, y = L[i].y, d = L[i].d;
      C[x][y] = "DLUR"[d], C[x + U[d]][y + V[d]] = "URDL"[d];
      D[x][y] = 1, D[x + U[d]][y + V[d]] = X[x][y] - 1;
    }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) printf("%d%c", D[i][j], " \n"[j == m]);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) printf("%c%c", C[i][j], " \n"[j == m]);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) magic();
  return 0;
}