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;
char _buf[100000], *_op(_buf), *_ed(_buf);
inline int getint() {
  int _s = 0, _f = 1;
  char _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),
                             _op == _ed)
                  ? EOF
                  : *_op++);
  while (!('0' <= _ch && _ch <= '9'))
    (_ch == '-') && (_f = -1),
        _ch =
            (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),
                            _op == _ed)
                 ? EOF
                 : *_op++);
  while (('0' <= _ch && _ch <= '9'))
    _s = _s * 10 + _ch - 48,
    _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),
                          _op == _ed)
               ? EOF
               : *_op++);
  return _s * _f;
}
const int N = 5e5 + 2, INF = 0x3f3f3f3f;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const char st[10] = "RDLU";
int T, n, m, tot, now;
int lk[N], kl[N], dfn[N];
vector<int> a[N], e[N], b[N], c[N];
inline int id(int x, int y) { return (x - 1) * m + y; }
inline void input() {
  n = getint(), m = getint(), tot = n * m;
  for (int i = 1; i <= n; i++) b[i].clear(), c[i].clear(), a[i].clear();
  for (int i = 1; i <= n; i++)
    a[i].resize(m + 1), b[i].resize(m + 1), c[i].resize(m + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) a[i][j] = getint();
}
inline int valid(int x, int y) { return 1 <= x && x <= n && 1 <= y && y <= m; }
inline void init(int tx = 0, int ty = 0) {
  now = 0;
  for (int i = 1; i <= tot * 3; i++) e[i].clear(), dfn[i] = lk[i] = kl[i] = 0;
  for (int x = 1; x <= n; x++)
    for (int y = 1; y <= m; y++)
      for (int i = 0; i <= 3; i++)
        if (valid(tx = x + dx[i], ty = y + dy[i]) && a[x][y] == a[tx][ty]) {
          e[id(x, y)].push_back(id(tx, ty));
        }
}
inline int dfs0(int u) {
  if (dfn[u] == now) return 0;
  dfn[u] = now;
  for (int v : e[u])
    if (!kl[v] || dfs0(kl[v])) return kl[v] = u, lk[u] = v, 1;
  return 0;
}
inline int dfs1(int u) {
  if (dfn[u] == now) return 0;
  dfn[u] = now;
  for (int v : e[u])
    if (!lk[v] || dfs1(lk[v])) return lk[v] = u, kl[u] = v, 1;
  return 0;
}
inline void work() {
  int tx, ty, cnt, u, v;
  for (int x = 1; x <= n; x++)
    for (int y = 1; y <= m; y++) {
      cnt = 0, u = id(x, y);
      for (int i = 0; i <= 3; i++)
        if (valid(tx = x + dx[i], ty = y + dy[i])) cnt += a[tx][ty] < a[x][y];
      if (cnt) {
        if (x + y & 1)
          e[u].push_back(u + tot), e[u + tot].push_back(u);
        else
          e[u].push_back(u + tot + tot), e[u + tot + tot].push_back(u);
      }
    }
  for (int x = 1; x <= n; x++)
    for (int y = 1; y <= m; y++) {
      cnt = 0, u = id(x, y);
      for (int i = 0; i <= 3; i++)
        if (valid(tx = x + dx[i], ty = y + dy[i])) cnt += a[tx][ty] < a[x][y];
      if (!cnt) {
        if (x + y & 1) {
          if (!lk[u] && ++now && !dfs0(u)) return void(cout << "NO\n");
        } else {
          if (!kl[u] && ++now && !dfs1(u)) return void(cout << "NO\n");
        }
      }
    }
  cout << "YES\n";
  for (int x = 1; x <= n; x++)
    for (int y = 1; y <= m; y++) {
      u = id(x, y);
      if (x + y & 1) {
        if (lk[u] && lk[u] <= tot) {
          for (int i = 0; i <= 3; i++)
            if (valid(tx = x + dx[i], ty = y + dy[i]) && id(tx, ty) == lk[u]) {
              if (!b[tx][ty])
                b[x][y] = 1;
              else
                b[x][y] = a[x][y] - 1;
              c[x][y] = i;
              break;
            }
          continue;
        }
      } else {
        if (kl[u] && kl[u] <= tot) {
          for (int i = 0; i <= 3; i++)
            if (valid(tx = x + dx[i], ty = y + dy[i]) && id(tx, ty) == kl[u]) {
              if (!b[tx][ty])
                b[x][y] = 1;
              else
                b[x][y] = a[x][y] - 1;
              c[x][y] = i;
              break;
            }
          continue;
        }
      }
      for (int i = 0; i <= 3; i++)
        if (valid(tx = x + dx[i], ty = y + dy[i]) && a[tx][ty] < a[x][y]) {
          b[x][y] = a[x][y] - a[tx][ty], c[x][y] = i;
          break;
        }
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cout << b[i][j] << " \n"[j == m];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cout << st[c[i][j]] << " \n"[j == m];
}
int main() {
  for (scanf("%d", &T); T--;) {
    input();
    init();
    work();
  }
  return 0;
}