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 = 1e9 + 7, N = 1e5 + 7;
struct Dinic {
  static const int N = 1e5 + 7, INF = 2147483647;
  int n, s, t, d[N], cur[N];
  vector<int> G[N];
  struct Edge {
    int from, to, flow;
    Edge(int _from, int _to, int _flow) {
      from = _from, to = _to, flow = _flow;
    }
  };
  vector<Edge> edges;
  void init(int _n, int _s, int _t) {
    n = _n;
    s = _s;
    t = _t;
    for (int i = 1; i <= n; i++) G[i].clear();
    edges.clear();
  }
  void add_edge(int u, int v, int flow) {
    edges.emplace_back(u, v, flow);
    edges.emplace_back(v, u, 0);
    G[u].push_back(edges.size() - 2);
    G[v].push_back(edges.size() - 1);
  }
  bool BFS() {
    for (int i = 1; i <= n; i++) d[i] = 0;
    d[s] = 1;
    queue<int> q({s});
    while (q.size()) {
      int u = q.front();
      q.pop();
      for (int e : G[u]) {
        int v = edges[e].to;
        if (!d[v] && edges[e].flow > 0) {
          d[v] = d[u] + 1;
          q.push(v);
        }
      }
    }
    return d[t];
  }
  int DFS(int u, int t, int cur_flow) {
    if (u == t || cur_flow == 0) return cur_flow;
    int flow = 0;
    for (int& i = cur[u]; i < G[u].size(); i++) {
      Edge& e = edges[G[u][i]];
      if (d[e.to] == d[e.from] + 1) {
        int f = DFS(e.to, t, min(cur_flow, e.flow));
        e.flow -= f;
        edges[G[u][i] ^ 1].flow += f;
        flow += f;
        cur_flow -= f;
        if (cur_flow == 0) break;
      }
    }
    return flow;
  }
  int maxflow() {
    int ret = 0;
    while (BFS()) {
      for (int i = 1; i <= n; i++) cur[i] = 0;
      ret += DFS(s, t, INF);
    }
    return ret;
  }
} f;
int di[] = {1, -1, 0, 0}, dj[] = {0, 0, 1, -1};
string dir = "DURL";
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > a(n, vector<int>(m)), optional(n, vector<int>(m, -1));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  int ss = n * m + 1, tt = n * m + 2, s = n * m + 3, t = n * m + 4;
  f.init(n * m + 4, s, t);
  auto id = [&](int i, int j) { return i * m + j + 1; };
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < 4; k++) {
        int ii = i + di[k], jj = j + dj[k];
        if (ii >= 0 && ii < n && jj >= 0 && jj < m) {
          if (a[ii][jj] < a[i][j]) {
            optional[i][j] = k;
          } else if (a[ii][jj] == a[i][j]) {
            if ((i + j) & 1) f.add_edge(id(i, j), id(ii, jj), 1);
          }
        }
      }
    }
  }
  int full = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if ((i + j) & 1) {
        if (optional[i][j] == -1) {
          f.add_edge(ss, t, 1);
          f.add_edge(s, id(i, j), 1);
          full++;
        } else {
          f.add_edge(ss, id(i, j), 1);
        }
      } else {
        if (optional[i][j] == -1) {
          f.add_edge(id(i, j), t, 1);
          f.add_edge(s, tt, 1);
          full++;
        } else {
          f.add_edge(id(i, j), tt, 1);
        }
      }
    }
  }
  f.add_edge(tt, ss, INF);
  int maxflow = f.maxflow();
  if (maxflow != full) {
    cout << "NO" << endl;
    return;
  }
  f.G[ss].pop_back();
  f.G[tt].pop_back();
  f.s = ss, f.t = tt;
  f.maxflow();
  vector<vector<int> > ans(n, vector<int>(m));
  vector<string> ans1(n, string(m, '#'));
  auto pos = [&](int id) { return make_pair((id - 1) / m, (id - 1) % m); };
  for (auto e : f.edges) {
    if (e.from <= n * m && e.to <= n * m && e.flow == 0) {
      pair<int, int> p1 = pos(e.from), p2 = pos(e.to);
      if ((p1.first + p1.second) % 2 == 0) continue;
      ans[p1.first][p1.second] = a[p1.first][p1.second] / 2;
      ans[p2.first][p2.second] = (a[p2.first][p2.second] + 1) / 2;
      assert(a[p1.first][p1.second] == a[p2.first][p2.second]);
      for (int k = 0; k < 4; k++) {
        if (make_pair(p1.first + di[k], p1.second + dj[k]) == p2) {
          ans1[p1.first][p1.second] = dir[k];
          ans1[p2.first][p2.second] = dir[k ^ 1];
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (ans[i][j] == 0) {
        assert(optional[i][j] != -1);
        int ii = i + di[optional[i][j]];
        int jj = j + dj[optional[i][j]];
        ans[i][j] = a[i][j] - a[ii][jj];
        ans1[i][j] = dir[optional[i][j]];
      }
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans1[i][j] << " ";
    }
    cout << endl;
  }
}
signed main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}