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;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return f == 1 ? x : -x;
}
const int N = 1e5 + 10, inf = 0x3f3f3f3f;
struct edge {
  int v, f, nxt;
} e[N << 3];
int first[N], cur[N], cnt;
inline void add(int u, int v, int f) {
  e[++cnt] = (edge){v, f, first[u]};
  first[u] = cnt;
  e[++cnt] = (edge){u, 0, first[v]};
  first[v] = cnt;
}
int n, m, s, t, ss, tt, sum, dep[N], a[N], E[N][4], ans1[N], ans2[N];
int dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, -1, 1};
queue<int> q;
inline int addedge(int u, int v, int fmx, int fmn) {
  if (fmn) {
    add(s, v, fmn);
    add(u, t, fmn);
  }
  if (fmx - fmn) add(u, v, fmx - fmn);
  return cnt ^ 1;
}
inline bool bfs() {
  while (!q.empty()) q.pop();
  memset(dep, 0x3f, sizeof(int) * (n * m + 5));
  dep[s] = 1;
  q.push(s);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = first[x], v; i; i = e[i].nxt) {
      v = e[i].v;
      if (!e[i].f || dep[v] <= dep[x] + 1) continue;
      dep[v] = dep[x] + 1;
      if (v == t) return 1;
      q.push(v);
    }
  }
  return 0;
}
int dfs(int x, int f) {
  if (x == t || !f) return f;
  int used = 0;
  for (int &i = cur[x], v, w; i; i = e[i].nxt) {
    v = e[i].v;
    if (!e[i].f || dep[v] != dep[x] + 1) continue;
    w = dfs(v, min(f, e[i].f));
    if (!w) continue;
    e[i].f -= w;
    e[i ^ 1].f += w;
    f -= w;
    used += w;
    if (!f) return used;
  }
  return used;
}
inline int dinic() {
  int flow = 0;
  while (bfs()) {
    memcpy(cur, first, sizeof(int) * (n * m + 5));
    flow += dfs(s, inf);
  }
  return flow;
}
inline int id(int x, int y) {
  if (x < 1 || y < 1 || x > n || y > m) return 0;
  return (x - 1) * m + y;
}
int main() {
  a[0] = inf;
  for (int T = read(), c; T--;) {
    n = read();
    m = read();
    memset(first, 0, sizeof(int) * (n * m + 5));
    memset(ans1, 0, sizeof(int) * (n * m + 5));
    memset(ans2, 0, sizeof(int) * (n * m + 5));
    cnt = 1;
    sum = 0;
    s = n * m + 1;
    t = s + 1;
    ss = t + 1;
    tt = ss + 1;
    for (int i = 1; i <= n * m; i++) a[i] = read();
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        c = (a[id(i, j)] <= min(min(a[id(i - 1, j)], a[id(i + 1, j)]),
                                min(a[id(i, j - 1)], a[id(i, j + 1)])));
        sum += c;
        if ((i + j) & 1)
          addedge(ss, id(i, j), 1, c);
        else
          addedge(id(i, j), tt, 1, c);
      }
    for (int i = 1, nx, ny; i <= n; i++)
      for (int j = 1; j <= m; j++)
        if ((i + j) & 1) {
          for (int r = 0; r < 4; r++) {
            nx = i + dx[r];
            ny = j + dy[r];
            if (a[id(nx, ny)] == a[id(i, j)]) {
              E[id(i, j)][r] = addedge(id(i, j), id(nx, ny), 1, 0);
            }
          }
        }
    addedge(tt, ss, inf, 0);
    if (dinic() != sum) {
      puts("NO");
      continue;
    }
    puts("YES");
    s = ss;
    t = tt;
    dinic();
    for (int i = 1, nx, ny; i <= n; i++)
      for (int j = 1; j <= m; j++)
        if ((i + j) & 1) {
          for (int r = 0; r < 4; r++) {
            nx = i + dx[r];
            ny = j + dy[r];
            if (a[id(nx, ny)] == a[id(i, j)]) {
              if (!e[E[id(i, j)][r]].f) {
                ans2[id(i, j)] = r;
                ans2[id(nx, ny)] = r ^ 1;
                ans1[id(i, j)] = 1;
                ans1[id(nx, ny)] = a[id(i, j)] - 1;
              }
            }
          }
        }
    for (int i = 1, nx, ny; i <= n; i++)
      for (int j = 1; j <= m; j++)
        if (!ans1[id(i, j)]) {
          for (int r = 0; r < 4; r++) {
            nx = i + dx[r];
            ny = j + dy[r];
            if (a[id(nx, ny)] < a[id(i, j)]) {
              ans2[id(i, j)] = r;
              ans1[id(i, j)] = a[id(i, j)] - a[id(nx, ny)];
              break;
            }
          }
        }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) cout << ans1[id(i, j)] << " ";
      puts("");
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        switch (ans2[id(i, j)]) {
          case 0:
            cout << "U ";
            break;
          case 1:
            cout << "D ";
            break;
          case 2:
            cout << "L ";
            break;
          case 3:
            cout << "R ";
            break;
        }
      }
      puts("");
    }
  }
  return (0 - 0);
}