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 <typename T>
void chkmax(T &first, T second) {
  first < second ? first = second : T();
}
template <typename T>
void chkmin(T &first, T second) {
  first > second ? first = second : T();
}
template <typename T>
void readint(T &first) {
  first = 0;
  int f = 1;
  char c;
  for (c = getchar(); !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) first = first * 10 + c - '0';
  first *= f;
}
const int MAXN = 100015, DIR[4][2] = {0, 1, 1, 0, 0, -1, -1, 0},
          INF = 0x3f3f3f3f;
const char NAME[4] = {'R', 'D', 'L', 'U'};
int n, m, src, sink, ss, tt;
int a[MAXN], ty[MAXN], num[MAXN];
inline int calc(int u, int v) {
  int first = v / m - u / m, second = v % m - u % m;
  for (int t = 0; t < 4; ++t)
    if (DIR[t][0] == first && DIR[t][1] == second) return t;
  return -1;
}
struct Edge {
  int v, f;
  Edge *next, *rev;
} * h[MAXN], pool[MAXN * 15];
int etot = 0;
void addEdge(int u, int v, int f) {
  Edge *p = &pool[++etot], *q = &pool[++etot];
  p->v = v, p->f = f, p->next = h[u], h[u] = p, p->rev = q;
  q->v = u, q->f = 0, q->next = h[v], h[v] = q, q->rev = p;
}
int level[MAXN], q[MAXN];
bool bfs() {
  int front = 1, rear = 0;
  for (int i = 0; i <= n * m + 3; ++i) level[i] = INF;
  level[src] = 1, q[++rear] = src;
  while (front <= rear) {
    int u = q[front++];
    for (Edge *p = h[u]; p; p = p->next)
      if (p->f && level[p->v] > level[u] + 1)
        level[p->v] = level[u] + 1, q[++rear] = p->v;
    if (level[sink] < INF) return 1;
  }
  return 0;
}
int dfs(int u, int key) {
  if (u == sink) return key;
  int ans = 0;
  for (Edge *p = h[u]; p; p = p->next)
    if (p->f && level[p->v] == level[u] + 1) {
      int t = dfs(p->v, min(p->f, key));
      p->f -= t, p->rev->f += t;
      key -= t, ans += t;
      if (!key) break;
    }
  if (!ans) level[u] = INF;
  return ans;
}
int dinic() {
  int ans = 0;
  while (bfs()) ans += dfs(src, INF);
  return ans;
}
void solve() {
  memset(h, 0, sizeof(h));
  memset(ty, -1, sizeof(ty));
  memset(num, 0, sizeof(num));
  readint(n), readint(m);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) readint(a[i * m + j]);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      for (int t = 0; t < 4; ++t) {
        int first = i + DIR[t][0], second = j + DIR[t][1];
        if (first < 0 || first >= n || second < 0 || second >= m) continue;
        if (a[i * m + j] > a[first * m + second]) ty[i * m + j] = t;
        if (a[i * m + j] == a[first * m + second] && ((i + j) & 1))
          addEdge(i * m + j, first * m + second, 1);
      }
  ss = n * m, tt = n * m + 1, src = n * m + 2, sink = n * m + 3;
  int c1 = 0, c2 = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if ((i + j) & 1) {
        if (ty[i * m + j] >= 0)
          addEdge(ss, i * m + j, 1);
        else
          addEdge(src, i * m + j, 1), ++c1;
      } else {
        if (ty[i * m + j] >= 0)
          addEdge(i * m + j, tt, 1);
        else
          addEdge(i * m + j, sink, 1), ++c2;
      }
  addEdge(ss, sink, c1), addEdge(src, tt, c2);
  addEdge(tt, ss, INF);
  int res = dinic();
  if (res < c1 + c2) {
    printf("NO\n");
    return;
  }
  for (int i = 0; i < n * m; ++i) {
    if (!(((i / m) + (i % m)) & 1)) continue;
    for (Edge *p = h[i]; p; p = p->next)
      if (p->v < n * m && p->rev->f) {
        ty[i] = calc(i, p->v), ty[p->v] = ty[i] ^ 2;
        num[i] = 1, num[p->v] = a[i] - 1;
        break;
      }
  }
  for (int i = 0; i < n * m; ++i)
    if (!num[i]) num[i] = a[i] - a[i + DIR[ty[i]][0] * m + DIR[ty[i]][1]];
  printf("YES\n");
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) printf("%d ", num[i * m + j]);
    putchar('\n');
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) putchar(NAME[ty[i * m + j]]), putchar(' ');
    putchar('\n');
  }
}
int main() {
  int T;
  readint(T);
  while (T--) solve();
  return 0;
}