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;
int Tes, n, m, p, k, fx[][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}, a[200010],
                     W[200010], U[1600010], V[1600010], sth = 0;
char op[] = {'R', 'L', 'D', 'U'}, s[200010], Ud[1600010], Vd[1600010];
int head[200010], cur[200010], o, dep[200010], S, T, SS, TT, cnt, tmp, flow;
struct edge {
  int to, link, w;
} e[1600010];
void add_edge(int u, int v, int w) {
  if (!w) return;
  e[++o].to = v, e[o].link = head[u], head[u] = o, e[o].w = w;
  e[++o].to = u, e[o].link = head[v], head[v] = o, e[o].w = 0;
  U[o] = SS;
}
void add_edge(int u, int v, int L, int R) {
  add_edge(SS, v, L), add_edge(u, TT, L), add_edge(u, v, R - L), tmp += L;
}
bool bfs() {
  memset(dep, 0, 4 * (cnt + 1));
  queue<int> q;
  dep[SS] = 1, q.push(SS);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = e[i].link) {
      sth++;
      if (dep[e[i].to] || !e[i].w) continue;
      dep[e[i].to] = dep[u] + 1;
      q.push(e[i].to);
    }
  }
  return dep[TT];
}
int dfs(int u, int in) {
  if (u == TT) return in;
  int out = 0;
  for (int &i = cur[u]; i; i = e[i].link) {
    sth++;
    if (dep[e[i].to] != dep[u] + 1 || !e[i].w) continue;
    int res = dfs(e[i].to, min(in, e[i].w));
    in -= res, out += res;
    e[i].w -= res, e[i ^ 1].w += res;
    if (!in) break;
  }
  return out;
}
void solve() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &a[(i - 1) * m + j]);
  o = 1, tmp = flow = 0;
  cnt = (n - 1) * m + m, S = ++cnt, T = ++cnt, SS = ++cnt, TT = ++cnt;
  for (int i = 1; i <= cnt; i++) head[i] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int L = 1;
      for (int k = 0; k < 4; k++) {
        int xx = i + fx[k][0], yy = j + fx[k][1];
        if (xx <= n && xx >= 1 && yy <= m && yy >= 1) {
          if (a[(xx - 1) * m + yy] < a[(i - 1) * m + j])
            L = 0, s[(i - 1) * m + j] = op[k],
            W[(i - 1) * m + j] = a[(i - 1) * m + j] - a[(xx - 1) * m + yy];
          if (a[(xx - 1) * m + yy] == a[(i - 1) * m + j] && ((i ^ j) & 1)) {
            add_edge((i - 1) * m + j, (xx - 1) * m + yy, 1);
            U[o] = (i - 1) * m + j, V[o] = (xx - 1) * m + yy;
            Ud[o] = op[k], Vd[o] = op[k ^ 1];
          }
        }
      }
      if ((i ^ j) & 1)
        add_edge(S, (i - 1) * m + j, L, 1);
      else
        add_edge((i - 1) * m + j, T, L, 1);
    }
  add_edge(T, S, 2e9);
  while (bfs()) memcpy(cur, head, 4 * (cnt + 1)), flow += dfs(SS, 2e9);
  if (tmp != flow) return puts("NO"), void();
  for (int i = 3; i <= o; i += 2) {
    if (e[i].w && U[i] != SS) {
      s[U[i]] = Ud[i], s[V[i]] = Vd[i];
      W[U[i]] = 1, W[V[i]] = a[U[i]] - 1;
    }
  }
  cerr << sth << "\n";
  puts("YES");
  for (int i = 1; i <= n; i++, puts(""))
    for (int j = 1; j <= m; j++) printf("%d ", W[(i - 1) * m + j]);
  for (int i = 1; i <= n; i++, puts(""))
    for (int j = 1; j <= m; j++) printf("%c ", s[(i - 1) * m + j]);
}
int main() {
  scanf("%d", &Tes);
  while (Tes--) solve();
}