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;
template <class T>
inline void cmin(T& a, T b) {
  ((a > b) && (a = b));
}
template <class T>
inline void cmax(T& a, T b) {
  ((a < b) && (a = b));
}
char IO;
template <class T = int>
T rd() {
  T s = 0;
  int f = 0;
  while (!isdigit(IO = getchar())) f |= IO == '-';
  do s = (s << 1) + (s << 3) + (IO ^ '0');
  while (isdigit(IO = getchar()));
  return f ? -s : s;
}
const int N = 2e5 + 10, INF = 1e9 + 7;
const int dx[5] = {0, 0, -1, 1};
const int dy[5] = {-1, 1, 0, 0};
const char dir[] = "LRUD";
int n, m, S, T, a[N], f[N], b[N];
int I(int i, int j) { return (i - 1) * m + j; }
int& A(int i, int j) { return a[I(i, j)]; }
int& F(int i, int j) { return f[I(i, j)]; }
int& B(int i, int j) { return b[I(i, j)]; }
struct Edge {
  int to, nxt, w;
} e[N * 16];
int head[N], ecnt;
void AddEdge(int u, int v, int w) {
  e[++ecnt] = (Edge){v, head[u], w};
  head[u] = ecnt;
}
void Link(int u, int v, int w) { AddEdge(u, v, w), AddEdge(v, u, 0); }
int dis[N];
int Bfs() {
  for (int i = 1, iend = T; i <= iend; ++i) dis[i] = INF;
  queue<int> que;
  que.push(S), dis[S] = 0;
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    for (int i = head[u]; i; i = e[i].nxt) {
      int v = e[i].to;
      if (!e[i].w || dis[v] <= dis[u] + 1) continue;
      dis[v] = dis[u] + 1, que.push(v);
    }
  }
  return dis[T] < INF;
}
int Dfs(int u, int in) {
  if (u == T) return in;
  int out = 0;
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    if (!e[i].w || dis[v] != dis[u] + 1) continue;
    int t = Dfs(v, min(e[i].w, in - out));
    out += t, e[i].w -= t, e[i ^ 1].w += t;
    if (in == out) break;
  }
  if (!out) dis[u] = 0;
  return out;
}
void Dinic() {
  while (Bfs()) Dfs(S, INF);
}
int main() {
  for (int _ = 1, _end = rd(); _ <= _end; ++_) {
    n = rd(), m = rd(), ecnt = 1;
    for (int i = 1, iend = n; i <= iend; ++i)
      for (int j = 1, jend = m; j <= jend; ++j) A(i, j) = rd();
    for (int i = 1, iend = n * m; i <= iend; ++i) b[i] = 0;
    S = n * m + 3, T = n * m + 4;
    for (int i = 1, iend = T; i <= iend; ++i) head[i] = 0;
    Link(T - 2, S - 2, INF);
    int X = 0, Y = 0;
    for (int i = 1, iend = n; i <= iend; ++i)
      for (int j = 1, jend = m; j <= jend; ++j) {
        int f = 0;
        for (int d = 0, dend = 3; d <= dend; ++d) {
          int x = i + dx[d], y = j + dy[d];
          if (x < 1 || y < 1 || x > n || y > m) continue;
          if ((i + j) & 1 && A(i, j) == A(x, y)) Link(I(i, j), I(x, y), 1);
          if (A(i, j) > A(x, y))
            F(i, j) = d, f = 1, B(i, j) = A(i, j) - A(x, y);
        }
        if ((i + j) & 1) {
          if (f)
            Link(S - 2, I(i, j), 1);
          else
            X++, Link(S, I(i, j), 1);
        } else {
          if (f)
            Link(I(i, j), T - 2, 1);
          else
            Y++, Link(I(i, j), T, 1);
        }
      }
    Link(S - 2, T, X), Link(S, T - 2, Y);
    Dinic();
    int fl = 1;
    for (int i = head[S]; i; i = e[i].nxt) fl &= !e[i].w;
    for (int i = head[T]; i; i = e[i].nxt) fl &= !e[i ^ 1].w;
    if (!fl) {
      puts("NO");
      continue;
    }
    puts("YES");
    for (int i = 1, iend = n * m; i <= iend; ++i) {
      int u = i;
      for (int i = head[u]; i; i = e[i].nxt)
        if (~i & 1) {
          int v = e[i].to;
          if (v <= n * m && !e[i].w) {
            b[u] = 1, b[v] = a[u] - 1;
            if (u > v) swap(u, v);
            if (v == u + m)
              f[u] = 3, f[v] = 2;
            else
              f[u] = 1, f[v] = 0;
            break;
          }
        }
    }
    for (int i = 1, iend = n; i <= iend; ++i) {
      for (int j = 1, jend = m; j <= jend; ++j) printf("%d ", B(i, j));
      puts("");
    }
    for (int i = 1, iend = n; i <= iend; ++i) {
      for (int j = 1, jend = m; j <= jend; ++j)
        putchar(dir[F(i, j)]), putchar(' ');
      puts("");
    }
  }
}