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>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  if (flag) x = -x;
}
using namespace std;
const int inf = 987654321;
int n, m, S, T;
struct edge {
  int nxt, to, val;
  edge() {}
  edge(int jzp, int zzz, int lsr) { nxt = jzp, to = zzz, val = lsr; }
} e[6001000];
int head[101000], ecnt = 1, hcur[101000];
inline void addedge(int from, int to, int val) {
  e[++ecnt] = edge(head[from], to, val);
  head[from] = ecnt;
}
inline void Addedge(int u, int v, int w) { addedge(u, v, w), addedge(v, u, 0); }
int dep[101000], que[101000], front, rear;
inline bool bfs() {
  memset(dep, 0x3f, sizeof(dep));
  front = rear = 0;
  for (int i = 1; i <= T; ++i) hcur[i] = head[i];
  que[++rear] = S;
  dep[S] = 0;
  while (front < rear) {
    int cur = que[++front];
    for (int i = head[cur]; i; i = e[i].nxt) {
      int to = e[i].to;
      if (!e[i].val || dep[to] <= 6001000) continue;
      dep[to] = dep[cur] + 1;
      que[++rear] = to;
    }
  }
  return dep[T] <= 6001000;
}
int dfs(int cur, int limi) {
  if (cur == T || !limi) return limi;
  int flow = 0;
  for (int i = hcur[cur]; i; i = e[i].nxt) {
    int to = e[i].to;
    hcur[cur] = i;
    if (dep[to] != dep[cur] + 1) continue;
    int tmp = dfs(to, min(e[i].val, limi));
    if (!tmp) continue;
    e[i].val -= tmp;
    e[i ^ 1].val += tmp;
    flow += tmp;
    limi -= tmp;
    if (!limi) break;
  }
  return flow;
}
int w[101000], nei[101000];
inline int Id(int i, int j) {
  if (i <= 0 || j <= 0 || i > n || j > m) return 0;
  return (i - 1) * m + j;
}
inline void cAddedge(int u, int v, int val) {
  if (w[u] == w[v]) Addedge(u, v, val);
}
inline char get_dir(int u, int v) {
  if (v == u + m) return 'D';
  if (v == u - m) return 'U';
  if (v == u + 1) return 'R';
  if (v == u - 1) return 'L';
  puts("QAQ");
  return 'Q';
}
int mat[101000], h[101000];
char dir[101000];
inline void work() {
  memset(w, 0x3f, sizeof(w));
  read(n), read(m);
  int s = n * m + 1, t = s + 1;
  S = t + 1, T = S + 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) read(w[Id(i, j)]);
  int ct = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (w[Id(i, j - 1)] < w[Id(i, j)])
        nei[Id(i, j)] = Id(i, j - 1);
      else if (w[Id(i, j + 1)] < w[Id(i, j)])
        nei[Id(i, j)] = Id(i, j + 1);
      else if (w[Id(i - 1, j)] < w[Id(i, j)])
        nei[Id(i, j)] = Id(i - 1, j);
      else if (w[Id(i + 1, j)] < w[Id(i, j)])
        nei[Id(i, j)] = Id(i + 1, j);
      else
        nei[Id(i, j)] = 0;
      if ((i + j) & 1) {
        if (nei[Id(i, j)])
          Addedge(s, Id(i, j), 1);
        else
          Addedge(S, Id(i, j), 1), Addedge(s, T, 1), ++ct;
        if (i >= 1) cAddedge(Id(i, j), Id(i - 1, j), 1);
        if (j >= 1) cAddedge(Id(i, j), Id(i, j - 1), 1);
        if (i <= n) cAddedge(Id(i, j), Id(i + 1, j), 1);
        if (j <= m) cAddedge(Id(i, j), Id(i, j + 1), 1);
      } else {
        if (nei[Id(i, j)])
          Addedge(Id(i, j), t, 1);
        else
          Addedge(S, t, 1), Addedge(Id(i, j), T, 1), ++ct;
      }
    }
  }
  Addedge(t, s, inf);
  int mxflow = 0;
  while (bfs()) mxflow += dfs(S, inf);
  if (mxflow < ct) {
    puts("NO");
    return;
  }
  puts("YES");
  for (int i = 2; i <= ecnt; i += 2)
    if (!e[i].val) {
      int u = e[i].to, v = e[i ^ 1].to;
      if (u < s && v < s) mat[u] = v, mat[v] = u;
    }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (mat[Id(i, j)])
        h[Id(i, j)] = 1, h[mat[Id(i, j)]] = w[Id(i, j)] - 1,
                dir[Id(i, j)] = get_dir(Id(i, j), mat[Id(i, j)]);
      else
        h[Id(i, j)] = w[Id(i, j)] - w[nei[Id(i, j)]],
                dir[Id(i, j)] = get_dir(Id(i, j), nei[Id(i, j)]);
    }
  }
  for (int i = 1; i <= n; ++i, puts(""))
    for (int j = 1; j <= m; ++j) printf("%d ", h[Id(i, j)]);
  for (int i = 1; i <= n; ++i, puts(""))
    for (int j = 1; j <= m; ++j) putchar(dir[Id(i, j)]), putchar(' ');
}
inline void clear() {
  memset(mat, 0, sizeof(mat));
  memset(nei, 0, sizeof(nei));
  memset(head, 0, sizeof(head));
  memset(h, 0, sizeof(h));
  ecnt = 1;
}
int main() {
  int _;
  read(_);
  while (_--) work(), clear();
  return 0;
}