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 = 100005, M = N * 10;
const int inf = INT_MAX / 3 * 2;
int n, m, cnt, ss, tt, sum, ut[M], vt[M];
char ud[M], vd[M];
namespace FlowGraph {
int head[N], v[M], nxt[M], ptr, t;
int w[M];
inline void padd_edge(int uu, int vv, int ww) {
  v[ptr] = vv;
  w[ptr] = ww;
  nxt[ptr] = head[uu];
  head[uu] = ptr++;
}
int dis[N], cur[N];
bool bfs(int s, int t) {
  memset(dis, -1, sizeof(int) * (cnt + 1));
  queue<int> q;
  q.push(s);
  dis[s] = 1;
  while (!q.empty()) {
    int nd = q.front();
    q.pop();
    for (int i = head[nd]; i != -1; i = nxt[i])
      if (w[i] && dis[v[i]] == -1) {
        dis[v[i]] = dis[nd] + 1;
        q.push(v[i]);
      }
  }
  return dis[t] != -1;
}
int dfs(int pos, int flow) {
  if (pos == t) return flow;
  int tmp = flow;
  for (int &i = cur[pos]; i != -1; i = nxt[i])
    if (w[i] && dis[v[i]] == dis[pos] + 1) {
      int fl = dfs(v[i], min(flow, w[i]));
      w[i] -= fl;
      w[i ^ 1] += fl;
      flow -= fl;
      if (!flow) break;
    }
  return tmp - flow;
}
void init() {
  ptr = 0;
  memset(head, -1, sizeof(int) * (cnt + 1));
}
inline void add_edge(int uu, int vv, int ww) {
  if (ww) padd_edge(uu, vv, ww), padd_edge(vv, uu, 0), ut[ptr - 1] = ss;
}
inline void add_edge(int uu, int vv, int l, int r) {
  add_edge(ss, vv, l);
  add_edge(uu, tt, l);
  add_edge(uu, vv, r - l);
  sum += l;
}
int dinic(int ss, int tt) {
  t = tt;
  int ret = 0;
  while (bfs(ss, tt))
    memcpy(cur, head, sizeof(int) * (cnt + 1)), ret += dfs(ss, inf);
  return ret;
}
};  // namespace FlowGraph
inline int id(int x, int y) { return (x - 1) * m + y; }
int a[N];
int d[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
char op[] = {'R', 'L', 'D', 'U'};
char s[N];
int w[N];
void _main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[id(i, j)];
  cnt = id(n, m);
  int S = ++cnt, T = ++cnt;
  ss = ++cnt, tt = ++cnt;
  FlowGraph::init();
  sum = 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 + d[k][0], yy = j + d[k][1];
        if (xx <= n && xx && yy <= m && yy) {
          if (a[id(xx, yy)] < a[id(i, j)])
            l = 0, s[id(i, j)] = op[k],
            w[id(i, j)] = a[id(i, j)] - a[id(xx, yy)];
          if (a[id(xx, yy)] == a[id(i, j)] && ((i ^ j) & 1)) {
            FlowGraph::add_edge(id(i, j), id(xx, yy), 1);
            ut[FlowGraph::ptr - 1] = id(i, j);
            vt[FlowGraph::ptr - 1] = id(xx, yy);
            ud[FlowGraph::ptr - 1] = op[k];
            vd[FlowGraph::ptr - 1] = op[k ^ 1];
          }
        }
      }
      if ((i ^ j) & 1)
        FlowGraph::add_edge(S, id(i, j), l, 1);
      else
        FlowGraph::add_edge(id(i, j), T, l, 1);
    }
  FlowGraph::add_edge(T, S, inf);
  int fl = FlowGraph::dinic(ss, tt);
  if (sum != fl) {
    cout << "NO" << endl;
    return;
  }
  for (int i = 1; i < FlowGraph::ptr; i += 2) {
    if (FlowGraph::w[i] && ut[i] != ss)
      s[ut[i]] = ud[i], s[vt[i]] = vd[i], w[ut[i]] = 1, w[vt[i]] = a[ut[i]] - 1;
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << w[id(i, j)] << ' ';
    cout << endl;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << s[id(i, j)] << ' ';
    cout << endl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) _main();
  return 0;
}