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 target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = acos(-1);
const double eps = 1e-10;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
struct Dinic {
  struct Edge {
    int to, rev;
    ll flo, cap;
  };
  int N;
  vector<vector<Edge>> adj;
  void init(int _N) {
    N = _N;
    adj.resize(N);
  }
  void add(int a, int b, ll cap, ll rcap = 0) {
    adj[a].push_back({b, (int)adj[b].size(), 0, cap});
    adj[b].push_back({a, (int)adj[a].size() - 1, 0, rcap});
  }
  vector<int> lev, ptr;
  bool bfs(int s, int t) {
    lev = ptr = vector<int>(N);
    queue<int> Q({s});
    lev[s] = 1;
    while (!Q.empty()) {
      int u = Q.front();
      Q.pop();
      for (auto e : adj[u]) {
        if (!lev[e.to] && e.cap - e.flo) Q.push(e.to), lev[e.to] = lev[u] + 1;
      }
    }
    return lev[t];
  }
  ll dfs(int v, int t, ll flo) {
    if (v == t) return flo;
    for (int& i = ptr[v]; i < (adj[v].size()); i++) {
      Edge& e = adj[v][i];
      ll dif = e.cap - e.flo;
      if (lev[e.to] != lev[v] + 1 || !dif) continue;
      if (ll df = dfs(e.to, t, min(flo, dif))) {
        e.flo += df;
        adj[e.to][e.rev].flo -= df;
        return df;
      }
    }
    return 0;
  }
  ll Flow(int s, int t) {
    ll tot = 0;
    while (bfs(s, t))
      while (ll df = dfs(s, t, numeric_limits<ll>::max())) tot += df;
    return tot;
  }
};
vector<vector<int>> arr;
vector<vector<char>> res;
vector<vector<int>> ans;
int n, m;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool inside(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; }
pair<int, int> pos(int a) { return {a / m, a % m}; }
char getdir(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first && a.second == b.second - 1) {
    return 'R';
  } else if (a.first == b.first && a.second == b.second + 1) {
    return 'L';
  } else if (a.first == b.first - 1 && a.second == b.second) {
    return 'D';
  } else if (a.first == b.first + 1 && a.second == b.second) {
    return 'U';
  } else {
    cout << "GFYAHFGAIJOTGIOWGEOG\n";
  }
  return '?';
}
void solve() {
  cin >> n >> m;
  Dinic G;
  G.init(n * m + 4);
  arr.resize(n);
  res.resize(n);
  ans.resize(n);
  for (auto i = (0); i < (n); ++i) {
    arr[i].resize(m);
    res[i].resize(m);
    ans[i].resize(m);
  }
  for (auto i = (0); i < (n); ++i) {
    for (auto j = (0); j < (m); ++j) {
      cin >> arr[i][j];
      ans[i][j] = -1;
    }
  }
  G.add(n * m + 1, n * m, INF);
  int req = 0;
  for (auto i = (0); i < (n); ++i) {
    for (auto j = (0); j < (m); ++j) {
      bool go = false;
      for (auto d = (0); d < (4); ++d) {
        if (inside(i + dx[d], j + dy[d])) {
          go |= (arr[i + dx[d]][j + dy[d]] < arr[i][j]);
          if (arr[i + dx[d]][j + dy[d]] == arr[i][j] && ((i + j) & 1) == 0) {
            G.add(i * m + j, (i + dx[d]) * m + j + dy[d], 1);
          }
        }
      }
      if (((i + j) & 1) == 0) {
        if (go) {
          G.add(n * m, i * m + j, 1);
        } else {
          G.add(n * m + 2, i * m + j, 1);
          G.add(n * m, n * m + 3, 1);
          req++;
        }
      } else {
        if (go) {
          G.add(i * m + j, n * m + 1, 1);
        } else {
          G.add(i * m + j, n * m + 3, 1);
          G.add(n * m + 2, n * m + 1, 1);
          req++;
        }
      }
    }
  }
  if (G.Flow(n * m + 2, n * m + 3) != req) {
    cout << "NO\n";
    return;
  }
  cout << "YES\n";
  for (auto i = (0); i < (n * m); ++i) {
    for (auto e : G.adj[i]) {
      if (e.flo > 0 && e.to < n * m) {
        auto [x, y] = pos(i);
        auto [dx, dy] = pos(e.to);
        res[x][y] = getdir({x, y}, {dx, dy});
        res[dx][dy] = getdir({dx, dy}, {x, y});
        ans[x][y] = 1;
        ans[dx][dy] = arr[x][y] - 1;
      }
    }
  }
  for (auto i = (0); i < (n); ++i) {
    for (auto j = (0); j < (m); ++j) {
      if (ans[i][j] != -1) continue;
      for (auto d = (0); d < (4); ++d) {
        if (inside(i + dx[d], j + dy[d])) {
          if (arr[i + dx[d]][j + dy[d]] < arr[i][j]) {
            res[i][j] = getdir({i, j}, {i + dx[d], j + dy[d]});
            ans[i][j] = arr[i][j] - arr[i + dx[d]][j + dy[d]];
          }
        }
      }
    }
  }
  for (auto i = (0); i < (n); ++i) {
    for (auto j = (0); j < (m); ++j) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
  for (auto i = (0); i < (n); ++i) {
    for (auto j = (0); j < (m); ++j) {
      cout << res[i][j] << " ";
    }
    cout << "\n";
  }
  return;
}
int T;
int main() {
  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin.tie(0)->sync_with_stdio(0);
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}