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>
#pragma GCC optimize("O3")
using namespace std;
template <class C>
void mini(C &a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C &a4, C b4) {
  a4 = max(a4, b4);
}
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << '=' << h << ',';
  _dbg(sdbg + 1, a...);
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
long long dx[] = {0, 0, 1, -1};
long long dy[] = {-1, 1, 0, 0};
string kier = "LRDU";
struct Sol {
  vector<vector<long long>> t;
  vector<vector<long long>> typ;
  vector<long long> vis;
  vector<vector<long long>> d;
  vector<long long> s;
  vector<vector<long long>> res;
  vector<string> resk;
  long long get(long long a, long long b) { return a * m + b; }
  void add_edge(long long a, long long b) {
    d[a].push_back(b);
    d[b].push_back(a);
  }
  bool dfs(long long v) {
    if (vis[v]) return 0;
    vis[v] = 1;
    for (long long el : d[v]) {
      if (s[el] == -1 || dfs(s[el])) {
        s[v] = el;
        s[el] = v;
        return 1;
      }
    }
    return 0;
  }
  void sko() {
    bool x = 1;
    while (x) {
      x = 0;
      for (long long i = (0); i <= ((long long)(n * m) - 1); i++) vis[i] = 0;
      for (long long i = (0); i <= ((long long)(n)-1); i++)
        for (long long j = (0); j <= ((long long)(m)-1); j++)
          if (typ[i][j] == 2) {
            long long id = get(i, j);
            if (s[id] == -1 && dfs(id)) {
              x = 1;
            }
          }
    }
  }
  long long n, m;
  void run() {
    cin >> n >> m;
    t.resize(n, vector<long long>(m));
    typ.resize(n, vector<long long>(m));
    res.resize(n, vector<long long>(m));
    resk.resize(n, string(m, '?'));
    d.resize(n * m);
    s.resize(n * m, -1);
    vis.resize(n * m);
    for (long long i = (0); i <= ((long long)(n)-1); i++)
      for (long long j = (0); j <= ((long long)(m)-1); j++) {
        cin >> t[i][j];
      }
    for (long long i = (0); i <= ((long long)(n)-1); i++)
      for (long long j = (0); j <= ((long long)(m)-1); j++)
        for (long long k = (0); k <= ((long long)(4) - 1); k++) {
          long long ni = i + dx[k];
          long long nj = j + dy[k];
          if (ni >= 0 && ni < n && nj >= 0 && nj < m) {
            (i, j, ni, nj);
            if (t[i][j] > t[ni][nj]) {
              typ[i][j] |= 1;
            } else if (t[i][j] == t[ni][nj]) {
              typ[i][j] |= 2;
            }
          }
        }
    (typ);
    for (long long i = (0); i <= ((long long)(n)-1); i++)
      for (long long j = (0); j <= ((long long)(m)-1); j++) {
        if (typ[i][j] == 0) {
          cout << "NO\n";
          return;
        }
      }
    for (long long i = (0); i <= ((long long)(n - 1) - 1); i++)
      for (long long j = (0); j <= ((long long)(m)-1); j++) {
        if (typ[i][j] == 2 && typ[i + 1][j] == 2 && t[i][j] == t[i + 1][j]) {
          add_edge(get(i, j), get(i + 1, j));
        }
      }
    for (long long i = (0); i <= ((long long)(n)-1); i++)
      for (long long j = (0); j <= ((long long)(m - 1) - 1); j++) {
        if (typ[i][j] == 2 && typ[i][j + 1] == 2 && t[i][j] == t[i][j + 1]) {
          add_edge(get(i, j), get(i, j + 1));
        }
      }
    sko();
    for (long long i = (0); i <= ((long long)(n - 1) - 1); i++)
      for (long long j = (0); j <= ((long long)(m)-1); j++) {
        if (typ[i][j] + typ[i + 1][j] == 5 && t[i][j] == t[i + 1][j]) {
          add_edge(get(i, j), get(i + 1, j));
        }
      }
    for (long long i = (0); i <= ((long long)(n)-1); i++)
      for (long long j = (0); j <= ((long long)(m - 1) - 1); j++) {
        if (typ[i][j] + typ[i][j + 1] == 5 && t[i][j] == t[i][j + 1]) {
          add_edge(get(i, j), get(i, j + 1));
        }
      }
    sko();
    for (long long i = (0); i <= ((long long)(n)-1); i++)
      for (long long j = (0); j <= ((long long)(m)-1); j++) {
        if (typ[i][j] == 2 && s[get(i, j)] == -1) {
          cout << "NO\n";
          return;
        }
      }
    for (long long i = (0); i <= ((long long)(n)-1); i++)
      for (long long j = (0); j <= ((long long)(m)-1); j++) {
        if (s[get(i, j)] == -1) {
          for (long long k = (0); k <= ((long long)(4) - 1); k++) {
            long long ni = i + dx[k];
            long long nj = j + dy[k];
            if (ni >= 0 && ni < n && nj >= 0 && nj < m) {
              if (t[i][j] > t[ni][nj]) {
                res[i][j] = t[i][j] - t[ni][nj];
                resk[i][j] = kier[k];
                break;
              }
            }
          }
        } else {
          for (long long k = (0); k <= ((long long)(4) - 1); k++) {
            long long ni = i + dx[k];
            long long nj = j + dy[k];
            if (ni >= 0 && ni < n && nj >= 0 && nj < m) {
              if (s[get(i, j)] == get(ni, nj)) {
                res[i][j] = t[i][j] / 2;
                res[ni][nj] = (t[i][j] + 1) / 2;
                resk[i][j] = kier[k];
                break;
              }
            }
          }
        }
      }
    cout << "YES\n";
    for (long long i = (0); i <= ((long long)(n)-1); i++) {
      for (long long j = (0); j <= ((long long)(m)-1); j++)
        cout << res[i][j] << " ";
      cout << "\n";
    }
    for (long long i = (0); i <= ((long long)(n)-1); i++) {
      for (long long j = (0); j <= ((long long)(m)-1); j++)
        cout << resk[i][j] << " ";
      cout << "\n";
    }
  }
};
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  if (0) cout << fixed << setprecision(6);
  long long t;
  cin >> t;
  while (t--) {
    Sol sol;
    sol.run();
  }
}