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 = 1e6 + 10;
const int inf = 1e9;
int n, m, to[N], ww[N], nxt[N], h[N],
    ett = 1, dep[N], s, t, cur[N], dx[4] = {1, 0, 0, -1}, dy[4] = {0, 1, -1, 0},
    sum[N], val[N];
char dir[N], str[] = "DRLU";
struct dat {
  int u, v;
  char du, dv;
} Ref[N];
void adde(int u, int v, int w) {
  to[++ett] = v;
  ww[ett] = w;
  nxt[ett] = h[u];
  h[u] = ett;
  to[++ett] = u;
  ww[ett] = 0;
  nxt[ett] = h[v];
  h[v] = ett;
}
bool bfs() {
  memset(dep, 0, 4 * (t + 1));
  queue<int> q;
  q.push(s);
  dep[s] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = h[u], v; v = to[i], i; i = nxt[i])
      if (!dep[v] && ww[i]) {
        dep[v] = dep[u] + 1;
        q.push(v);
        if (v == t) return 1;
      }
  }
  return 0;
}
int dfs(int u, int flow) {
  if (u == t) return flow;
  int ret = 0;
  for (int &i = cur[u], v; v = to[i], i; i = nxt[i])
    if (dep[v] == dep[u] + 1 && ww[i]) {
      int d = dfs(v, min(flow, ww[i]));
      ww[i] -= d;
      ww[i ^ 1] += d;
      ret += d;
      flow -= d;
      if (!flow) break;
    }
  return ret;
}
int dinic() {
  int ret = 0;
  while (bfs()) {
    memcpy(cur, h, 4 * (t + 1));
    ret += dfs(s, inf);
  }
  return ret;
}
int id(int i, int j) { return (i - 1) * m + j; }
bool in(int x, int y) { return 1 <= x && x <= n && 1 <= y && y <= m; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    cin >> n >> m;
    int ss = 0, tt = n * m + 1;
    s = n * m + 2;
    t = n * m + 3;
    for (int i = 1; i <= n * m; i++) cin >> sum[i];
    int cnt = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        bool fl = 0;
        for (int d = 0; d < 4; d++) {
          int x = i + dx[d], y = j + dy[d];
          if (in(x, y) && ((i + j) & 1) && sum[id(i, j)] == sum[id(x, y)]) {
            adde(id(i, j), id(x, y), 1);
            Ref[ett] = (dat){id(i, j), id(x, y), str[d], str[3 - d]};
          }
          if (in(x, y) && sum[id(x, y)] < sum[id(i, j)]) {
            dir[id(i, j)] = str[d];
            val[id(i, j)] = sum[id(i, j)] - sum[id(x, y)];
            fl = 1;
          }
        }
        if (!fl) {
          ++cnt;
          if ((i + j) & 1)
            adde(s, id(i, j), 1), adde(ss, t, 1);
          else
            adde(s, tt, 1), adde(id(i, j), t, 1);
        } else {
          if ((i + j) & 1)
            adde(ss, id(i, j), 1);
          else
            adde(id(i, j), tt, 1);
        }
      }
    adde(tt, ss, inf);
    if (dinic() != cnt)
      cout << "NO\n";
    else {
      cout << "YES\n";
      for (int i = 3; i <= ett; i += 2)
        if (ww[i] && Ref[i].u) {
          dir[Ref[i].u] = Ref[i].du;
          dir[Ref[i].v] = Ref[i].dv;
          val[Ref[i].u] = 1;
          val[Ref[i].v] = sum[Ref[i].u] - 1;
        }
      for (int i = 1; i <= n; i++, cout << '\n')
        for (int j = 1; j <= m; j++) cout << val[id(i, j)] << ' ';
      for (int i = 1; i <= n; i++, cout << '\n')
        for (int j = 1; j <= m; j++) cout << dir[id(i, j)] << ' ';
      for (int i = 0; i <= n * m + 3; i++) h[i] = 0;
      for (int i = 0; i <= ett; i++) Ref[i].u = 0;
      ett = 1;
    }
  }
  return 0;
}