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 IO {
char buf[500005], *p1 = buf, *p2 = buf, out[500005], *pout = out,
                  *eout = out + 500000;
inline char nc() {
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 500000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline void pc(char c) {
  pout == eout && (fwrite(out, 1, 500000, stdout), pout = out);
  (*pout++) = c;
}
inline void flush() { fwrite(out, 1, pout - out, stdout), pout = out; }
inline void put(int x) {
  static char stk[40];
  int top = 0;
  while (x) stk[top++] = x % 10, x /= 10;
  while (top--) pc(stk[top] + '0');
}
inline int read() {
  char ch = nc();
  int sum = 0;
  for (; ch < '0' || ch > '9'; ch = nc())
    ;
  while (ch >= '0' && ch <= '9')
    sum = (sum << 3) + (sum << 1) + ch - 48, ch = nc();
  return sum;
}
}  // namespace IO
using IO::pc;
using IO::put;
int dx[] = {-1, 0, 0, 1}, dy[] = {0, -1, 1, 0};
char to[] = "ULRD";
struct edge {
  int to, nxt, fl;
} e[100005 << 4];
int head[100005], cur[100005], cnte, d[100005], S, T, nod;
void ad(int u, int v, int fl) {
  e[cnte] = (edge){v, head[u], fl};
  head[u] = cnte++;
}
void adde(int u, int v, int fl) {
  ad(u, v, fl);
  ad(v, u, 0);
}
bool bfs() {
  queue<int> q;
  fill(d, d + 1 + nod, -1), q.push(S), d[S] = 0, memcpy(cur, head, sizeof(cur));
  for (int u; q.size(); q.pop())
    for (int i = cur[u = q.front()], v; ~i; i = e[i].nxt)
      if (e[i].fl > 0 && d[v = e[i].to] == -1) d[v] = d[u] + 1, q.push(v);
  return d[T] != -1;
}
int dfs(int u, int fl) {
  if (u == T) return fl;
  int ans = 0;
  for (int &i = cur[u], v; ~i; i = e[i].nxt)
    if (e[i].fl && d[u] + 1 == d[v = e[i].to]) {
      int tmp = dfs(v, min(fl - ans, e[i].fl));
      e[i].fl -= tmp;
      e[i ^ 1].fl += tmp;
      ans += tmp;
      if (ans == fl) break;
    }
  return ans;
}
int n, m, sz;
void work() {
  n = IO::read();
  m = IO::read();
  sz = n * m;
  vector<vector<int>> w(n, vector<int>(m)), co = w, dir = w, id = w;
  for (int i = 0, cnt = 0; i < n; i++)
    for (int j = 0; j < m; j++) w[i][j] = IO::read(), id[i][j] = cnt++;
  int fs = sz, ft = sz + 1, cnt[2] = {0, 0};
  S = sz + 2, T = S + 1, nod = T + 1, fill(head, head + 1 + nod, -1), cnte = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      bool F = 0;
      int u = id[i][j];
      for (int d = 0; d < 4; d++) {
        int ni = i + dx[d], nj = j + dy[d];
        if (ni < 0 || ni >= n || nj < 0 || nj >= m) continue;
        F |= (w[i][j] > w[ni][nj]);
        if (w[i][j] == w[ni][nj] && (i + j & 1)) adde(id[ni][nj], u, 1);
      }
      if (F) {
        if (i + j & 1)
          adde(u, ft, 1);
        else
          adde(fs, u, 1);
      } else {
        if (i + j & 1)
          adde(u, T, 1), cnt[1]++;
        else
          adde(S, u, 1), cnt[0]++;
      }
    }
  adde(fs, T, cnt[0]), adde(S, ft, cnt[1]), adde(ft, fs, 0x3f3f3f3f);
  bool ans = 1;
  while (bfs())
    while (dfs(S, 0x3f3f3f3f))
      ;
  for (int i = head[S]; ~i; i = e[i].nxt)
    if (e[i].fl) ans = 0;
  if (!ans)
    return pc('N'), pc('O'), pc('\n');
  else
    pc('Y'), pc('E'), pc('S'), pc('\n');
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if ((i + j) % 2 == 0)
        for (int u = id[i][j], x = head[u], v; ~x; x = e[x].nxt) {
          if ((v = e[x].to) >= sz || e[x].fl) continue;
          int ni = v / m, nj = v % m;
          co[i][j] = 1, co[ni][nj] = w[i][j] - 1;
          for (int d = 0; d < 4; d++)
            if (ni == i + dx[d] && nj == j + dy[d])
              dir[i][j] = to[d], dir[ni][nj] = to[d ^ 3];
        }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!co[i][j])
        for (int d = 0; d < 4; d++) {
          int ni = i + dx[d], nj = j + dy[d];
          if (ni < 0 || ni >= n || nj < 0 || nj >= m) continue;
          if (w[i][j] > w[ni][nj])
            dir[i][j] = to[d], co[i][j] = w[i][j] - w[ni][nj];
        }
  for (auto x : co) {
    for (int y : x) put(y), pc(' ');
    pc('\n');
  }
  for (auto x : dir) {
    for (char y : x) pc(y), pc(' ');
    pc('\n');
  }
}
int main() {
  for (int t = IO::read(); t--;) work();
  IO::flush();
}