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>
namespace kactl {
using namespace std;
struct Dinic {
  struct Edge {
    int to, rev;
    long long c, oc;
    long long flow() const { return max(oc - c, 0LL); }
  };
  vector<int> lvl, ptr, q;
  vector<vector<Edge>> adj;
  Dinic(int n) : lvl(n), ptr(n), q(n), adj(n) {}
  void addEdge(int a, int b, long long c, long long rcap = 0) {
    adj[a].push_back({b, (int)(adj[b]).size(), c, c});
    adj[b].push_back({a, (int)(adj[a]).size() - 1, rcap, rcap});
  }
  long long dfs(int v, int t, long long f) {
    if (v == t || !f) return f;
    for (int& i = ptr[v]; i < (int)(adj[v]).size(); i++) {
      Edge& e = adj[v][i];
      if (lvl[e.to] == lvl[v] + 1)
        if (long long p = dfs(e.to, t, min(f, e.c))) {
          e.c -= p, adj[e.to][e.rev].c += p;
          return p;
        }
    }
    return 0;
  }
  long long calc(int s, int t) {
    long long flow = 0;
    q[0] = s;
    for (int L = 0; L < (31); ++L) do {
        lvl = ptr = vector<int>((int)(q).size());
        int qi = 0, qe = lvl[s] = 1;
        while (qi < qe && !lvl[t]) {
          int v = q[qi++];
          for (Edge e : adj[v])
            if (!lvl[e.to] && e.c >> (30 - L))
              q[qe++] = e.to, lvl[e.to] = lvl[v] + 1;
        }
        while (long long p = dfs(s, t, LLONG_MAX)) flow += p;
      } while (lvl[t]);
    return flow;
  }
  bool leftOfMinCut(int a) { return lvl[a] != 0; }
};
}  // namespace kactl
int main() {
  using namespace std;
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int NCASES;
  cin >> NCASES;
  while (NCASES--) {
    int N, M;
    cin >> N >> M;
    vector<int> G(N * M);
    for (auto& v : G) cin >> v;
    const int V = N * M + 4;
    int S = N * M;
    int T = N * M + 1;
    int S2 = N * M + 2;
    int T2 = N * M + 3;
    kactl::Dinic flower(V);
    vector<int> cost(N * M);
    vector<char> dir(N * M, '\0');
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < M; j++) {
        if (i - 1 >= 0 && G[i * M + j] > G[(i - 1) * M + j]) {
          cost[i * M + j] = G[i * M + j] - G[(i - 1) * M + j];
          dir[i * M + j] = 'U';
        } else if (i + 1 < N && G[i * M + j] > G[(i + 1) * M + j]) {
          cost[i * M + j] = G[i * M + j] - G[(i + 1) * M + j];
          dir[i * M + j] = 'D';
        } else if (j - 1 >= 0 && G[i * M + j] > G[i * M + (j - 1)]) {
          cost[i * M + j] = G[i * M + j] - G[i * M + (j - 1)];
          dir[i * M + j] = 'L';
        } else if (j + 1 < M && G[i * M + j] > G[i * M + (j + 1)]) {
          cost[i * M + j] = G[i * M + j] - G[i * M + (j + 1)];
          dir[i * M + j] = 'R';
        }
        if (dir[i * M + j]) {
          if ((i ^ j) & 1) {
            flower.addEdge(S, i * M + j, 1);
          } else {
            flower.addEdge(i * M + j, T, 1);
          }
        }
      }
    }
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < M; j++) {
        if (i + 1 < N && G[i * M + j] == G[(i + 1) * M + j]) {
          int a = i * M + j;
          int b = (i + 1) * M + j;
          if ((i ^ j) & 1) std::swap(a, b);
          flower.addEdge(a, b, 1);
        }
        if (j + 1 < M && G[i * M + j] == G[i * M + (j + 1)]) {
          int a = i * M + j;
          int b = i * M + (j + 1);
          if ((i ^ j) & 1) std::swap(a, b);
          flower.addEdge(a, b, 1);
        }
      }
    }
    int num_even = 0;
    int num_odd = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < M; j++) {
        if ((i ^ j) & 1) {
          num_odd++;
          flower.addEdge(i * M + j, T2, 1);
        } else {
          num_even++;
          flower.addEdge(S2, i * M + j, 1);
        }
      }
    }
    flower.addEdge(S2, T, num_odd);
    flower.addEdge(S, T2, num_even);
    flower.addEdge(T, S, N * M);
    int tot_flow = int(flower.calc(S2, T2));
    if (tot_flow != N * M) {
      cout << "NO" << '\n';
      continue;
    } else {
      cout << "YES" << '\n';
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
          if ((i ^ j) & 1) continue;
          for (const auto& e : flower.adj[i * M + j]) {
            if (0 <= e.to && e.to < N * M && e.flow()) {
              int i2 = e.to / M;
              int j2 = e.to % M;
              assert(abs(i - i2) + abs(j - j2) == 1);
              assert(G[i * M + j] == G[i2 * M + j2]);
              cost[i * M + j] = G[i * M + j] / 2;
              cost[i2 * M + j2] = (G[i * M + j] + 1) / 2;
              if (i2 - i == 1) {
                dir[i * M + j] = 'D';
                dir[i2 * M + j2] = 'U';
              } else if (i2 - i == -1) {
                dir[i * M + j] = 'U';
                dir[i2 * M + j2] = 'D';
              } else if (j2 - j == 1) {
                dir[i * M + j] = 'R';
                dir[i2 * M + j2] = 'L';
              } else if (j2 - j == -1) {
                dir[i * M + j] = 'L';
                dir[i2 * M + j2] = 'R';
              } else
                assert(false);
            }
          }
        }
      }
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
          cout << cost[i * M + j] << " \n"[j + 1 == M];
        }
      }
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
          assert(dir[i * M + j]);
          cout << dir[i * M + j] << " \n"[j + 1 == M];
        }
      }
    }
  }
  return 0;
}