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;
template <typename C, typename R = C, bool lb = false>
struct dinic {
  static_assert(std::is_arithmetic<C>::value, "flow_type must be arithmetic");
  static_assert(std::is_arithmetic<R>::value, "result_type must be arithmetic");
  static const C oo = std::numeric_limits<C>::max();
  struct edge {
    int src;
    int dst;
    int rev;
    C cap, flow;
    edge(int src, int dst, int rev, C cap, C flow)
        : src(src), dst(dst), rev(rev), cap(cap), flow(flow) {}
  };
  dinic(int n)
      : adj(n + 2 * lb),
        que(n + 2 * lb),
        level(n + 2 * lb),
        edge_pos(n + 2 * lb) {}
  int add_edge(int src, int dst, C cap, C rcap = 0) {
    adj[src].emplace_back(src, dst, (int)adj[dst].size(), cap, lb ? rcap : 0);
    if (src == dst) adj[src].back().rev++;
    adj[dst].emplace_back(dst, src, (int)adj[src].size() - 1, lb ? 0 : rcap, 0);
    return (int)adj[src].size() - 1 - (src == dst);
  }
  inline bool side_of_S(int u) { return level[u] == -1; }
  R max_flow(int source, int sink) {
    R flow = 0;
    while (true) {
      int front = 0, back = 0;
      std::fill(level.begin(), level.end(), -1);
      for (level[que[back++] = sink] = 0; front < back && level[source] == -1;
           ++front) {
        int u = que[front];
        for (const edge &e : adj[u])
          if (level[e.dst] == -1 && rev(e).flow < rev(e).cap)
            level[que[back++] = e.dst] = 1 + level[u];
      }
      if (level[source] == -1) break;
      std::fill(edge_pos.begin(), edge_pos.end(), 0);
      std::function<C(int, C)> find_path = [&](int from, C res) {
        if (from == sink) return res;
        for (int &ept = edge_pos[from]; ept < (int)adj[from].size(); ++ept) {
          edge &e = adj[from][ept];
          if (e.flow == e.cap || level[e.dst] + 1 != level[from]) continue;
          C push = find_path(e.dst, std::min(res, e.cap - e.flow));
          if (push > 0) {
            e.flow += push;
            rev(e).flow -= push;
            if (e.flow == e.cap) ++ept;
            return push;
          }
        }
        return static_cast<C>(0);
      };
      for (C f; (f = find_path(source, oo)) > 0;) flow += f;
    }
    return flow;
  }
  R max_flow_lb(int source, int sink) {
    int n = adj.size() - 2;
    vector<C> delta(n + 2);
    for (int u = 0; u < n; ++u)
      for (auto &e : adj[u]) {
        delta[u] -= e.flow;
        delta[e.dst] += e.flow;
      }
    R sum = 0;
    int s = n, t = n + 1;
    for (int u = 0; u < n; ++u) {
      if (delta[u] > 0) {
        add_edge(s, u, delta[u], 0);
        sum += delta[u];
      } else if (delta[u] < 0)
        add_edge(u, t, -delta[u], 0);
    }
    add_edge(sink, source, oo, 0);
    if (max_flow(s, t) != sum) return -1;
    R flow = adj[sink].back().flow;
    adj[sink].pop_back();
    adj[source].pop_back();
    return flow;
  }
  std::vector<std::vector<edge>> adj;

 private:
  std::vector<int> que;
  std::vector<int> level;
  std::vector<int> edge_pos;
  inline edge &rev(const edge &e) { return adj[e.dst][e.rev]; }
};
const int mov[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
const char cmov[4] = {'D', 'U', 'R', 'L'};
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n, vector<int>(m));
    for (auto &i : a)
      for (auto &j : i) cin >> j;
    vector<vector<pair<int, char>>> ans(n, vector<pair<int, char>>(m));
    dinic<int, int, true> d(n * m * 2 + 2);
    int source = n * m * 2, sink = source + 1;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j) {
        bool g = false;
        for (int k = 0; k < 4; ++k) {
          int ni = i + mov[k][0];
          int nj = j + mov[k][1];
          if (ni >= 0 && ni < n && nj >= 0 && nj < m) {
            if (a[i][j] > a[ni][nj]) {
              g = true;
              ans[i][j] = {a[i][j] - a[ni][nj], cmov[k]};
            }
            if (((i ^ j) & 1) && a[i][j] == a[ni][nj])
              d.add_edge(i * m + j, n * m + ni * m + nj, 1);
          }
        }
        if ((i ^ j) & 1)
          d.add_edge(source, i * m + j, 1, !g);
        else
          d.add_edge(n * m + i * m + j, sink, 1, !g);
      }
    if (d.max_flow_lb(source, sink) == -1)
      cout << "NO\n";
    else {
      for (int i = 0; i < n * m; ++i)
        for (auto j : d.adj[i])
          if (j.dst < 2 * n * m && j.flow) {
            if ((j.dst - n * m) / m == i / m) {
              int x = i % m, y = (j.dst - n * m) % m;
              if (x > y) swap(x, y);
              ans[i / m][x] = {1, 'R'};
              ans[i / m][y] = {a[i / m][x] - 1, 'L'};
            } else {
              int x = i / m, y = (j.dst - n * m) / m;
              if (x > y) swap(x, y);
              ans[x][i % m] = {1, 'D'};
              ans[y][i % m] = {a[x][i % m] - 1, 'U'};
            }
          }
      cout << "YES\n";
      for (auto &i : ans)
        for (auto &j : i) cout << j.first << " \n"[&j == &i.back()];
      for (auto &i : ans)
        for (auto &j : i) cout << j.second << " \n"[&j == &i.back()];
    }
  }
  return 0;
}