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;
class matching {
 public:
  vector<vector<int>> g;
  vector<int> pa;
  vector<int> pb;
  vector<int> was;
  int n, m;
  int res;
  int iter;
  matching(int _n, int _m) : n(_n), m(_m) {
    assert(0 <= n && 0 <= m);
    pa = vector<int>(n, -1);
    pb = vector<int>(m, -1);
    was = vector<int>(n, 0);
    g.resize(n);
    res = 0;
    iter = 0;
  }
  void add(int from, int to) {
    assert(0 <= from && from < n && 0 <= to && to < m);
    g[from].push_back(to);
  }
  bool dfs(int v) {
    was[v] = iter;
    for (int u : g[v]) {
      if (pb[u] == -1) {
        pa[v] = u;
        pb[u] = v;
        return true;
      }
    }
    for (int u : g[v]) {
      if (was[pb[u]] != iter && dfs(pb[u])) {
        pa[v] = u;
        pb[u] = v;
        return true;
      }
    }
    return false;
  }
  int solve() {
    while (true) {
      iter++;
      int add = 0;
      for (int i = 0; i < n; i++) {
        if (pa[i] == -1 && dfs(i)) {
          add++;
        }
      }
      if (add == 0) {
        break;
      }
      res += add;
    }
    return res;
  }
  int run_one(int v) {
    if (pa[v] != -1) {
      return 0;
    }
    iter++;
    return (int)dfs(v);
  }
};
int tt;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> tt;
  while (tt--) {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n, vector<int>(m));
    map<int, vector<pair<int, int>>> aux;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> a[i][j];
        aux[a[i][j]].push_back({i, j});
      }
    }
    vector<vector<int>> res(n, vector<int>(m));
    vector<vector<char>> g(n, vector<char>(m));
    auto get_dir = [&](int x, int y, int xx, int yy) {
      assert(abs(x - xx) + abs(y - yy) == 1);
      char ans;
      if (xx == x + 1) ans = 'D';
      if (xx == x - 1) ans = 'U';
      if (yy == y + 1) ans = 'R';
      if (yy == y - 1) ans = 'L';
      g[x][y] = ans;
    };
    bool ok = true;
    for (auto foo : aux) {
      vector<pair<int, int>> nodes = foo.second;
      int p = nodes.size();
      matching gr(p, p);
      map<pair<int, int>, int> id;
      for (int i = 0; i < p; i++) id[nodes[i]] = i;
      vector<int> dx = {1, 0, -1, 0};
      vector<int> dy = {0, 1, 0, -1};
      for (auto xy : nodes) {
        int x = xy.first;
        int y = xy.second;
        bool self = false;
        for (int i = 0; i < 4; i++) {
          int sx = x + dx[i];
          int sy = y + dy[i];
          if (sx < 0 || sx >= n || sy < 0 || sy >= m) continue;
          if (a[sx][sy] < a[x][y])
            self = true;
          else if (a[sx][sy] == a[x][y]) {
            gr.add(id[make_pair(x, y)], id[make_pair(sx, sy)]);
          }
        }
        if (self) gr.add(id[make_pair(x, y)], id[make_pair(x, y)]);
      }
      if (gr.solve() < p) {
        ok = false;
        break;
      }
      vector<int> pa = gr.pa;
      vector<vector<int>> cycles;
      vector<int> was(p);
      for (int i = 0; i < p; i++) {
        if (was[i]) continue;
        was[i] = 1;
        if (pa[i] == i) {
          int x = nodes[i].first;
          int y = nodes[i].second;
          for (int i = 0; i < 4; i++) {
            int sx = x + dx[i];
            int sy = y + dy[i];
            if (sx < 0 || sx >= n || sy < 0 || sy >= m) continue;
            if (a[sx][sy] < a[x][y]) {
              get_dir(x, y, sx, sy);
              res[x][y] = a[x][y] - a[sx][sy];
              break;
            }
          }
          continue;
        }
        cycles.push_back({i});
        while (pa[cycles.back().back()] != i) {
          cycles.back().push_back(pa[cycles.back().back()]);
          was[cycles.back().back()] = 1;
        }
      }
      for (vector<int> pos : cycles) {
        assert(pos.size() % 2 == 0);
        for (int i = 0; i < (int)pos.size(); i += 2) {
          int x = nodes[pos[i]].first, y = nodes[pos[i]].second;
          int sx = nodes[pos[i + 1]].first, sy = nodes[pos[i + 1]].second;
          get_dir(x, y, sx, sy);
          get_dir(sx, sy, x, y);
          res[x][y] = a[x][y] / 2;
          res[sx][sy] = (a[sx][sy] + 1) / 2;
        }
      }
    }
    if (!ok) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          cout << res[i][j] << " ";
        }
        cout << "\n";
      }
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          cout << g[i][j] << " ";
        }
        cout << "\n";
      }
    }
  }
  return 0;
}