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 = 2e5 + 100;
const int dir[4][2] = {{0, -1}, {0, 1}, {1, 0}, {-1, 0}};
const char C[4] = {'L', 'R', 'D', 'U'};
int n, m, mat[N], V[N], D[N], deg[N], vis[N], S, T, ans;
map<pair<int, int>, int> mp;
int head[N], cur[N], dep[N], ce;
struct edge {
  int to, nxt, cap, flow;
} e[N * 20];
int id(int x, int y) {
  return (x > 0 && y > 0 && x <= n && y <= m) ? (m * (x - 1) + y) : 0;
}
queue<int> q;
void lnk(int a, int b, int c) {
  e[++ce] = (edge){b, head[a], c, 0}, head[a] = ce;
  e[++ce] = (edge){a, head[b], 0, 0}, head[b] = ce;
}
bool bfs() {
  memset(dep, 0, T + 1 << 2);
  memcpy(cur, head, T + 1 << 2);
  while (!q.empty()) q.pop();
  q.push(S), dep[S] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = e[i].nxt) {
      int v = e[i].to;
      if (!dep[v] && e[i].cap > e[i].flow) {
        dep[v] = dep[u] + 1;
        q.push(v);
        if (v == T) return 1;
      }
    }
  }
  return 0;
}
int dfs(int u, int lim) {
  if (u == T) return lim;
  int tag = 0;
  for (int &i = cur[u]; i; i = e[i].nxt)
    if (dep[e[i].to] == dep[u] + 1 && e[i].cap > e[i].flow) {
      int d = dfs(e[i].to, min(lim - tag, e[i].cap - e[i].flow));
      e[i].flow += d, e[i ^ 1].flow -= d, tag += d;
      if (tag == lim) return lim;
    }
  dep[u] = -1;
  return tag;
}
void solve() {
  cin >> n >> m;
  T = n * m, S = ++T, ++T, ce = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cin >> mat[id(i, j)];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      for (int t = 0; t < 4; ++t) {
        int x = i + dir[t][0], y = j + dir[t][1];
        if (!id(x, y)) continue;
        if (mat[id(x, y)] < mat[id(i, j)])
          D[id(i, j)] = t, V[id(i, j)] = mat[id(i, j)] - mat[id(x, y)];
        if (mat[id(x, y)] == mat[id(i, j)] && ((x + y) & 1))
          lnk(id(x, y), id(i, j), 1);
      }
      if ((i + j) & 1) {
        if (!V[id(i, j)])
          --deg[S], ++deg[id(i, j)];
        else
          lnk(S, id(i, j), 1);
      } else {
        if (!V[id(i, j)])
          ++deg[T], --deg[id(i, j)];
        else
          lnk(id(i, j), T, 1);
      }
    }
  S += 2, T += 2, ans = 0;
  for (int i = 1; i <= T - 2; ++i)
    if (deg[i] < 0)
      lnk(i, T, -deg[i]);
    else if (deg[i] > 0)
      lnk(S, i, deg[i]), ans += deg[i];
  lnk(T - 2, S - 2, 1e9);
  while (bfs()) ans -= dfs(S, 1e9);
  if (ans) {
    puts("NO");
    return;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if ((i + j) & 1)
        for (int k = head[id(i, j)]; k; k = e[k].nxt)
          if (e[k].flow > 0 && e[k].to <= n * m) {
            int to = e[k].to, x = (to - 1) / m + 1, y = (to - 1) % m + 1;
            D[id(i, j)] = mp[{x - i, y - j}], D[id(x, y)] = mp[{i - x, j - y}];
            V[id(i, j)] = 1, V[id(x, y)] = mat[id(i, j)] - 1;
          }
  puts("YES");
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) printf("%d ", V[id(i, j)]);
    puts("");
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) printf("%c ", C[D[id(i, j)]]);
    puts("");
  }
  memset(head, 0, T + 1 << 2), memset(deg, 0, T + 1 << 2);
  memset(vis, 0, T + 1 << 2), memset(mat, 0, T + 1 << 2);
  memset(V, 0, T + 1 << 2);
}
int main() {
  mp[{0, -1}] = 0, mp[{0, 1}] = 1, mp[{1, 0}] = 2, mp[{-1, 0}] = 3;
  int Case;
  cin >> Case;
  while (Case--) solve();
  return 0;
}