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;
using ll = long long;
const int MAXN = 1e5 + 10;
int dx[] = {-1, 0, 0, 1}, dy[] = {0, -1, 1, 0};
string to = "ULRD";
struct edge {
  int to, rev, f, cap;
};
vector<edge> adj[MAXN];
void add_edge(int u, int v, int c) {
  edge a = {v, (int)adj[v].size(), 0, c};
  edge b = {u, (int)adj[u].size(), 0, 0};
  adj[u].push_back(a);
  adj[v].push_back(b);
}
int ptr[MAXN], dis[MAXN], src, dst, nod;
bool bfs() {
  fill(dis, dis + nod, -1);
  queue<int> q({src});
  dis[src] = 0;
  while (q.size() && dis[dst] == -1) {
    int u = q.front();
    q.pop();
    for (auto e : adj[u]) {
      if (dis[e.to] == -1 && e.f < e.cap) {
        dis[e.to] = dis[u] + 1;
        q.push(e.to);
      }
    }
  }
  return dis[dst] != -1;
}
int dfs(int u, int f) {
  if (u == dst || !f) return f;
  for (int &i = ptr[u]; i < adj[u].size(); i++) {
    auto &e = adj[u][i];
    if (dis[e.to] != dis[u] + 1) continue;
    if (int pushed = dfs(e.to, min(f, e.cap - e.f))) {
      e.f += pushed;
      adj[e.to][e.rev].f -= pushed;
      return pushed;
    }
  }
  return 0;
}
int maxflow() {
  int res = 0;
  while (bfs()) {
    fill(ptr, ptr + nod, 0);
    while (int flow = dfs(src, INT_MAX)) res += flow;
  }
  return res;
}
void solve() {
  int n, m, sz;
  cin >> n >> m;
  sz = n * m;
  vector<vector<int>> grid(n, vector<int>(m));
  vector<vector<int>> cost = grid, dem = grid;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> grid[i][j];
  nod = sz + 4;
  src = sz + 2;
  dst = sz + 3;
  int fs = sz, ft = sz + 1;
  for (int i = 0; i < nod; i++) adj[i].clear();
  auto coord = [&](int i, int j) { return m * i + j; };
  vector<array<int, 4>> edges;
  array<int, 2> cnt = {0, 0};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      bool drop = false;
      for (int d = 0; d < 4; d++) {
        int ni = i + dx[d], nj = j + dy[d];
        if (ni < 0 || ni >= n || nj < 0 || nj >= m) continue;
        if (grid[i][j] > grid[ni][nj]) drop = true;
        if (grid[i][j] == grid[ni][nj] && (ni > i || nj > j))
          edges.push_back({i, j, ni, nj});
      }
      if (!drop) dem[i][j] = 1;
      int u = coord(i, j);
      if (dem[i][j]) {
        if ((i + j) % 2 == 0) {
          add_edge(src, u, 1);
          cnt[0]++;
        } else {
          add_edge(u, dst, 1);
          cnt[1]++;
        }
      } else {
        if ((i + j) % 2 == 0)
          add_edge(fs, u, 1);
        else
          add_edge(u, ft, 1);
      }
    }
  }
  add_edge(fs, dst, cnt[0]);
  add_edge(src, ft, cnt[1]);
  add_edge(ft, fs, 4 * sz);
  for (auto &[x1, y1, x2, y2] : edges) {
    int u = coord(x1, y1), v = coord(x2, y2);
    if ((x1 + y1) % 2 == 0) {
      add_edge(u, v, 1);
    } else {
      add_edge(v, u, 1);
    }
  }
  bool good = true;
  int mf = maxflow();
  for (auto &e : adj[src]) {
    if (e.f < e.cap) good = false;
  }
  if (!good) {
    cout << "NO\n";
    return;
  } else
    cout << "YES\n";
  vector<vector<char>> dir(n, vector<char>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if ((i + j) % 2) continue;
      int u = coord(i, j);
      for (auto &e : adj[u]) {
        int v = e.to;
        if (v >= sz || e.f != e.cap) continue;
        int ni = v / m, nj = v % m;
        cost[i][j] = 1;
        cost[ni][nj] = grid[i][j] - 1;
        if (ni == i + 1) {
          dir[i][j] = 'D';
          dir[i + 1][j] = 'U';
        }
        if (ni == i - 1) {
          dir[i][j] = 'U';
          dir[i - 1][j] = 'D';
        }
        if (nj == j + 1) {
          dir[i][j] = 'R';
          dir[i][j + 1] = 'L';
        }
        if (nj == j - 1) {
          dir[i][j] = 'L';
          dir[i][j - 1] = 'R';
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (cost[i][j]) continue;
      for (int d = 0; d < 4; d++) {
        int ni = i + dx[d], nj = j + dy[d];
        if (ni < 0 || ni >= n || nj < 0 || nj >= m) continue;
        if (grid[i][j] > grid[ni][nj]) {
          dir[i][j] = to[d];
          cost[i][j] = grid[i][j] - grid[ni][nj];
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << cost[i][j] << " ";
    }
    cout << '\n';
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << dir[i][j] << " ";
    }
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
}