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;
struct Dinic {
  vector<int> lst, nxt, to, cap, lv, qu, cur;
  Dinic(int v) : lv(v), qu(v), cur(v) { lst.assign(v, -1); }
  void _add(int u, int v, int c) {
    nxt.push_back(lst[u]);
    lst[u] = nxt.size() - 1;
    to.push_back(v);
    cap.push_back(c);
  }
  void add(int u, int v, int c) {
    _add(u, v, c);
    _add(v, u, 0);
  }
  void bfs(int s) {
    lv.assign(lv.size(), 0);
    int nr = 0;
    qu[nr++] = s;
    lv[s] = 1;
    for (int i = 0; i < nr; i++) {
      int u = qu[i];
      cur[u] = lst[u];
      for (int p = lst[u]; p >= 0; p = nxt[p]) {
        int v = to[p];
        if (cap[p] && !lv[v]) {
          lv[v] = lv[u] + 1;
          qu[nr++] = v;
        }
      }
    }
  }
  int dfs(int u, int t, int fl) {
    int sum = 0;
    if (u == t || !fl) {
      return fl;
    }
    for (int p = cur[u]; p >= 0; p = nxt[p], cur[u] = p) {
      int v = to[p];
      if (cap[p] && lv[v] == lv[u] + 1) {
        int x = dfs(v, t, min(fl - sum, cap[p]));
        cap[p] -= x;
        cap[p ^ 1] += x;
        sum += x;
        if (fl <= sum) {
          break;
        }
      }
    }
    return sum;
  }
  int flow(int s, int t) {
    int cnt = 0;
    while (1) {
      bfs(s);
      if (!lv[t]) {
        break;
      }
      cnt += dfs(s, t, 1 << 30);
    }
    return cnt;
  }
};
int N, M;
int a[100005];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
char dc[] = "DURL";
int ga(int x, int y) { return a[x * M + y]; }
void solve() {
  cin >> N >> M;
  int s = N * M;
  int t = s + 1;
  int s_ = s + 2;
  int t_ = s + 3;
  Dinic dinic(t_ + 1);
  for (int i = 0; i < N * M; i++) cin >> a[i];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) {
      int p = i * M + j;
      int v = a[p];
      int has_lt = 0, has_eq = 0;
      for (int k = 0; k < 4; k++) {
        int x = i + dx[k];
        int y = j + dy[k];
        if (x < 0 || x >= N || y < 0 || y >= M) continue;
        if (ga(x, y) < v) {
          has_lt = 1;
        } else if (ga(x, y) == v) {
          has_eq = 1;
        }
      }
      if ((i + j) & 1) {
        dinic.add(s, p, 1);
        if (has_lt) {
          dinic.add(p, t_, 1);
        } else if (!has_eq) {
          cout << "NO" << endl;
          return;
        }
        for (int k = 0; k < 4; k++) {
          int x = p / M + dx[k];
          int y = p % M + dy[k];
          if (x < 0 || x >= N || y < 0 || y >= M) continue;
          if (a[p] == a[x * M + y]) dinic.add(p, x * M + y, 1);
        }
      } else {
        dinic.add(p, t, 1);
        if (has_lt) {
          dinic.add(s_, p, 1);
        } else if (!has_eq) {
          cout << "NO" << endl;
          return;
        }
      }
    }
  dinic.add(s, s_, (N * M + 1) / 2);
  dinic.add(t_, t, (N * M) / 2);
  dinic.add(s_, t_, N * M);
  int fl = dinic.flow(s, t);
  if (fl != N * M) {
    cout << "NO" << endl;
    return;
  }
  cout << "YES" << endl;
  vector<int> pr(N * M), dr(N * M);
  pr.assign(N * M, -1);
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) {
      int u = i * M + j;
      if ((i + j) & 1) {
        for (int p = dinic.lst[u]; p >= 0; p = dinic.nxt[p]) {
          if (dinic.to[p] < N * M && !dinic.cap[p]) {
            pr[u] = dinic.to[p];
            pr[dinic.to[p]] = u;
          }
        }
      }
    }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (j) cout << " ";
      int u = i * M + j;
      if (pr[u] >= 0) {
        if ((i + j) & 1) {
          cout << 1;
        } else {
          cout << a[u] - 1;
        }
        for (int k = 0; k < 4; k++) {
          int x = u / M + dx[k];
          int y = u % M + dy[k];
          if (x < 0 || x >= N || y < 0 || y >= M) continue;
          if (x * M + y == pr[u]) {
            dr[u] = k;
            break;
          }
        }
      } else {
        for (int k = 0; k < 4; k++) {
          int x = u / M + dx[k];
          int y = u % M + dy[k];
          if (x < 0 || x >= N || y < 0 || y >= M) continue;
          if (a[x * M + y] < a[u]) {
            cout << a[u] - a[x * M + y];
            dr[u] = k;
            break;
          }
        }
      }
    }
    cout << endl;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (j) cout << " ";
      int u = i * M + j;
      cout << dc[dr[u]];
    }
    cout << endl;
  }
}
int main() {
  int T;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}