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;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
const int N = 1e5 + 6;
vector<int> g[N];
int u[N];
int mt[N];
bool bad[N];
int tt = 228;
bool dfs(int v) {
  if (u[v] == tt) return false;
  u[v] = tt;
  for (int x : g[v]) {
    if (mt[x] == -1 || dfs(mt[x])) {
      mt[x] = v;
      return true;
    }
  }
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<vector<int> > arr(n, vector<int>(m));
    vector<vector<int> > dir(n, vector<int>(m));
    vector<vector<int> > id(n, vector<int>(m));
    vector<int> cell(n * m);
    int ptr = 0;
    vector<int> l, r;
    bool fucked = false;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        id[i][j] = ptr++;
        bad[id[i][j]] = true;
        if ((i + j) % 2 == 0) {
          l.push_back(id[i][j]);
        } else {
          r.push_back(id[i][j]);
        }
        g[id[i][j]].clear();
        cin >> arr[i][j];
        if (arr[i][j] == 1) fucked = true;
        cell[id[i][j]] = arr[i][j];
      }
    }
    if (fucked) {
      cout << "NO\n";
      continue;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        for (int t = 0; t < 4; t++) {
          int a = i + dx[t], b = j + dy[t];
          if (0 <= a && a < n && 0 <= b && b < m && arr[a][b] < arr[i][j]) {
            bad[id[i][j]] = false;
            dir[i][j] = t;
          }
        }
      }
    }
    auto add_edge = [&](int a, int b) { g[a].push_back(b); };
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        for (int t = 0; t < 4; t++) {
          int a = i + dx[t], b = j + dy[t];
          if (0 <= a && a < n && 0 <= b && b < m && arr[a][b] == arr[i][j]) {
            add_edge(id[i][j], id[a][b]);
          }
        }
      }
    }
    bool fail = false;
    auto solve = [&](vector<int> a, vector<int> b) {
      vector<char> ok(n * m);
      for (int x : b) ok[x] = 1;
      tt++;
      sort(a.begin(), a.end(), [&](int u, int v) { return bad[u] > bad[v]; });
      for (int x : b) mt[x] = -1;
      for (int x : a) {
        vector<int> now;
        for (int t : g[x]) {
          if (ok[t]) {
            now.push_back(t);
          }
        }
        g[x] = now;
      }
      vector<int> ret;
      for (int x : a) {
        if (dfs(x)) {
          ret.push_back(x);
          tt++;
        } else if (bad[x]) {
          fail = true;
        }
      }
      return ret;
    };
    auto x = solve(l, r);
    auto y = solve(r, x);
    if (fail) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
      string ret = "LRUD";
      vector<int> match(n * m, -1);
      vector<int> lul(n * m);
      for (int t : x) {
        match[t] = mt[t];
        match[mt[t]] = t;
        lul[t] = 1;
        lul[mt[t]] = cell[t] - 1;
        ;
      }
      vector<vector<int> > cost(n, vector<int>(m));
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (match[id[i][j]] == -1) {
            pair<int, int> go = make_pair(i + dx[dir[i][j]], j + dy[dir[i][j]]);
            cout << arr[i][j] - arr[go.first][go.second] << ' ';
          } else {
            cout << lul[id[i][j]] << ' ';
          }
        }
        cout << '\n';
      }
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (match[id[i][j]] == -1) {
            cout << ret[dir[i][j]] << ' ';
          } else {
            int my_dir = -1;
            for (int p = 0; p < 4; p++) {
              int a = i + dx[p], b = j + dy[p];
              if (0 <= a && a < n && 0 <= b && b < m &&
                  id[a][b] == match[id[i][j]]) {
                my_dir = p;
              }
            }
            cout << ret[my_dir] << ' ';
          }
        }
        cout << '\n';
      }
    }
  }
}