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 INF = INT_MAX;
const int MN = 100010, ME = 1000010;
int src, snk, nno, ned;
int q[MN], fin[MN], pro[MN], dist[MN];
int flow[2 * ME], cap[2 * ME];
int sig[2 * ME], to[2 * ME];
inline void init(int _src, int _snk, int _n) {
  src = _src, snk = _snk, nno = _n, ned = 0;
  for (int i = 0; i <= nno; i++) fin[i] = -1;
}
inline void add(int u, int v, int c) {
  to[ned] = v, cap[ned] = c, flow[ned] = 0, sig[ned] = fin[u], fin[u] = ned++;
  to[ned] = u, cap[ned] = 0, flow[ned] = 0, sig[ned] = fin[v], fin[v] = ned++;
}
inline void reset(int _src, int _snk) {
  src = _src, snk = _snk;
  for (int i = 0; i < ned; i++) flow[i] = 0;
}
bool bfs() {
  int st, en, u, v;
  for (int i = 0; i <= nno; i++) dist[i] = -1;
  dist[src] = st = en = 0;
  q[en++] = src;
  while (st < en) {
    u = q[st++];
    for (int e = fin[u]; e >= 0; e = sig[e]) {
      v = to[e];
      if (flow[e] < cap[e] && dist[v] == -1) {
        dist[v] = dist[u] + 1;
        q[en++] = v;
      }
    }
  }
  return dist[snk] != -1;
}
int dfs(int u, int mn) {
  if (u == snk) return mn;
  int au, v;
  for (int &e = pro[u]; e >= 0; e = sig[e]) {
    v = to[e];
    if (flow[e] < cap[e] && dist[v] == dist[u] + 1)
      if (au = dfs(v, min(mn, cap[e] - flow[e]))) {
        flow[e] += au;
        flow[e ^ 1] -= au;
        return au;
      }
  }
  return 0;
}
int dinic() {
  int f = 0, au;
  while (bfs()) {
    for (int i = 0; i <= nno; i++) pro[i] = fin[i];
    while (au = dfs(src, INF)) f += au;
  }
  return f;
}
int n, m, in[MN], out[MN];
int mx[] = {1, -1, 0, 0};
int my[] = {0, 0, 1, -1};
char dir[] = {'D', 'U', 'R', 'L'};
vector<vector<int> > a;
inline int num(int i, int j) { return i * m + j; }
void solve() {
  cin >> n >> m;
  a = vector<vector<int> >(n, vector<int>(m));
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (m); j++) cin >> a[i][j];
  int s = n * m, t = s + 1, ss = t + 1, tt = ss + 1, sd = 0;
  init(ss, tt, tt);
  for (int i = 0; i < (tt); i++) in[i] = out[i] = 0;
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (m); j++) {
      int f = 0;
      for (int l = 0; l < (4); l++) {
        int x = i + mx[l];
        int y = j + my[l];
        if (0 <= x && x < n && 0 <= y && y < m && a[i][j] > a[x][y]) {
          f = 1;
        }
      }
      if (!f) {
        for (int l = 0; l < (4); l++) {
          int x = i + mx[l];
          int y = j + my[l];
          if (0 <= x && x < n && 0 <= y && y < m && a[i][j] == a[x][y]) {
            int u = num(i, j);
            int v = num(x, y);
            if (i % 2 != j % 2) swap(u, v);
            add(u, v, 1);
          }
        }
      }
      if (i % 2 == j % 2) {
        if (f)
          add(s, num(i, j), 1);
        else
          out[s]++, in[num(i, j)]++;
      } else {
        if (f)
          add(num(i, j), t, 1);
        else
          out[num(i, j)]++, in[t]++;
      }
    }
  for (int i = 0; i < (tt); i++) {
    sd += in[i];
    if (in[i]) add(ss, i, in[i]);
    if (out[i]) add(i, tt, out[i]);
  }
  add(t, s, ME);
  int res = dinic();
  if (res == sd) {
    cout << "YES" << '\n';
    for (int i = 0; i < (n); i++) {
      for (int j = 0; j < (m); j++) {
        int f = 0;
        for (int e = fin[num(i, j)]; e >= 0; e = sig[e])
          if (to[e] < n * m && flow[e]) {
            if (i % 2 == j % 2)
              cout << a[i][j] - 1;
            else
              cout << 1;
            f = 1;
          }
        if (!f)
          for (int l = 0; l < (4); l++) {
            int x = i + mx[l];
            int y = j + my[l];
            if (0 <= x && x < n && 0 <= y && y < m && a[i][j] > a[x][y]) {
              cout << a[i][j] - a[x][y];
              break;
            }
          }
        cout << " ";
      }
      cout << '\n';
    }
    for (int i = 0; i < (n); i++) {
      for (int j = 0; j < (m); j++) {
        int f = 0;
        for (int e = fin[num(i, j)]; e >= 0; e = sig[e])
          if (to[e] < n * m && flow[e]) {
            int u = num(i, j);
            int v = to[e];
            if (u - m == v)
              cout << 'U';
            else if (u + m == v)
              cout << 'D';
            else if (u + 1 == v)
              cout << 'R';
            else
              cout << 'L';
            f = 1;
          }
        if (!f)
          for (int l = 0; l < (4); l++) {
            int x = i + mx[l];
            int y = j + my[l];
            if (0 <= x && x < n && 0 <= y && y < m && a[i][j] > a[x][y]) {
              cout << dir[l];
              break;
            }
          }
        cout << " ";
      }
      cout << '\n';
    }
  } else {
    cout << "NO" << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}