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 uint64_t seed =
    std::chrono::system_clock::now().time_since_epoch().count();
mt19937_64 rnd(seed);
const int MOD = 998244353;
struct Dinic {
  struct Edge {
    int from, to;
    long long cap, flow;
    Edge(int u, int v, long long c) : from(u), to(v), cap(c), flow(0) {}
  };
  int n, m, s, t;
  vector<vector<int>> g;
  vector<Edge> edges;
  vector<int> dis;
  vector<int> cur;
  Dinic(int n, int s, int t) : n(n), s(s), t(t), g(n), dis(n), cur(n) {}
  void addEdge(int from, int to, long long cap) {
    edges.push_back(Edge(from, to, cap));
    edges.push_back(Edge(to, from, 0));
    m = edges.size();
    g[from].push_back(m - 2);
    g[to].push_back(m - 1);
  }
  bool bfs() {
    fill(dis.begin(), dis.end(), n);
    dis[s] = 0;
    queue<int> qq;
    qq.push(s);
    int cnt = 0;
    while (!qq.empty()) {
      cnt++;
      int len = qq.size();
      while (len--) {
        int p = qq.front();
        qq.pop();
        for (int a : g[p]) {
          Edge &e = edges[a];
          if (e.flow >= e.cap) continue;
          if (dis[e.to] == n) {
            dis[e.to] = cnt;
            qq.push(e.to);
          }
        }
      }
    }
    return dis[t] != n;
  }
  long long dfs(int x, long long a) {
    if (x == t || a == 0) return a;
    long long flow = 0, f;
    for (; cur[x] < g[x].size(); cur[x]++) {
      Edge &e = edges[g[x][cur[x]]];
      if (e.cap > e.flow && dis[x] + 1 == dis[e.to] &&
          (f = dfs(e.to, min(a, e.cap - e.flow))) > 0) {
        flow += f;
        e.flow += f;
        edges[g[x][cur[x]] ^ 1].flow -= f;
        a -= f;
        if (a == 0) break;
      }
    }
    return flow;
  }
  long long maxFlow() {
    long long flow = 0;
    while (bfs()) {
      fill(cur.begin(), cur.end(), 0);
      flow += dfs(s, INT_MAX);
    }
    return flow;
  }
};
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(n, vector<int>(m));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  auto getNode = [&](int a, int b) { return a * m + b; };
  auto getPos = [&](int a) {
    int t1 = a / m, t2 = a % m;
    return make_pair(t1, t2);
  };
  int T = n * m;
  int SS = T + 1, TT = SS + 1;
  string dir = "LRDU";
  int dd[][2] = {{0, -1}, {0, 1}, {1, 0}, {-1, 0}};
  vector<vector<int>> fall(n, vector<int>(m, -1));
  Dinic dinic(TT + 1, SS, TT);
  int c1 = 0, c2 = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      int cNode = getNode(i, j);
      for (int k = 0; k < 4; k++) {
        int ni = i + dd[k][0], nj = j + dd[k][1];
        if (ni < 0 || nj < 0 || ni >= n || nj >= m) continue;
        int nn = getNode(ni, nj);
        if (a[ni][nj] < a[i][j]) {
          fall[i][j] = nn;
        } else if (a[ni][nj] == a[i][j] && (i + j) % 2 == 0) {
          dinic.addEdge(cNode, nn, 1);
        }
      }
      if (fall[i][j] == -1) {
        if ((i + j) % 2 == 0) {
          dinic.addEdge(SS, cNode, 1);
          c1++;
        } else {
          dinic.addEdge(cNode, TT, 1);
          c2++;
        }
      } else {
        if ((i + j) % 2 == 0) {
          dinic.addEdge(T, cNode, 1);
        } else {
          dinic.addEdge(cNode, T, 1);
        }
      }
    }
  dinic.addEdge(T, TT, c1);
  dinic.addEdge(SS, T, c2);
  int r = dinic.maxFlow();
  if (r != c1 + c2) {
    cout << "NO\n";
    return;
  }
  vector<vector<int>> r1(n, vector<int>(m));
  vector<vector<char>> r2(n, vector<char>(m));
  auto getDir = [&](int i, int j, int ni, int nj) {
    for (int k = 0; k < 4; k++) {
      if (i + dd[k][0] == ni && j + dd[k][1] == nj) {
        return dir[k];
      }
    };
    return '#';
  };
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (fall[i][j] != -1) {
        auto p = getPos(fall[i][j]);
        r1[i][j] = a[i][j] - a[p.first][p.second];
        r2[i][j] = getDir(i, j, p.first, p.second);
      }
    }
  for (auto e : dinic.edges) {
    if (e.from >= T || e.to >= T || e.cap > e.flow || e.cap == 0) continue;
    auto p1 = getPos(e.from);
    auto p2 = getPos(e.to);
    r1[p1.first][p1.second] = a[p1.first][p1.second] - 1;
    r1[p2.first][p2.second] = 1;
    r2[p1.first][p1.second] = getDir(p1.first, p1.second, p2.first, p2.second);
    r2[p2.first][p2.second] = getDir(p2.first, p2.second, p1.first, p1.second);
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << r1[i][j] << " ";
    }
    cout << "\n";
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << r2[i][j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  int T = 1;
  cin >> T;
  for (int i = 1; i <= T; i++) {
    solve();
  }
  cout.flush();
  return 0;
}