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;
const int N = 222222, M = N << 3, mod = 1e9 + 7;
template <typename T>
void read(T &x) {
  int ch = getchar();
  x = 0;
  bool f = false;
  for (; ch < '0' || ch > '9'; ch = getchar()) f |= ch == '-';
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
template <typename T>
bool chmax(T &a, const T &b) {
  if (a < b) return a = b, 1;
  return 0;
}
template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) return a = b, 1;
  return 0;
}
int ksm(int a, int b) {
  int res = 1;
  for (; b; b >>= 1, a = (long long)a * a % mod)
    if (b & 1) res = (long long)res * a % mod;
  return res;
}
int r, c, n, s[N], val[N], S, T, SS, TT, cnt, head[N], to[M], nxt[M], cap[M],
    in[N];
char dir[N];
int id(int x, int y) { return (x - 1) * c + y; }
void add(int a, int b, int c) {
  to[++cnt] = b;
  nxt[cnt] = head[a];
  head[a] = cnt;
  cap[cnt] = c;
  to[++cnt] = a;
  nxt[cnt] = head[b];
  head[b] = cnt;
  cap[cnt] = 0;
}
bool check(int x, int y) {
  int now = id(x, y);
  if (x > 1 && s[now] > s[now - c]) {
    dir[now] = 'U';
    val[now] = s[now] - s[now - c];
    return true;
  }
  if (x < r && s[now] > s[now + c]) {
    dir[now] = 'D';
    val[now] = s[now] - s[now + c];
    return true;
  }
  if (y > 1 && s[now] > s[now - 1]) {
    dir[now] = 'L';
    val[now] = s[now] - s[now - 1];
    return true;
  }
  if (y < c && s[now] > s[now + 1]) {
    dir[now] = 'R';
    val[now] = s[now] - s[now + 1];
    return true;
  }
  return false;
}
int maxf, dep[N], cur[N], qu[N], fr, re;
bool bfs() {
  memset(dep, -1, n + 5 << 2);
  memcpy(cur, head, n + 5 << 2);
  qu[fr = dep[S] = 0] = S;
  re = 1;
  while (fr < re) {
    int u = qu[fr++];
    for (int i = head[u]; i; i = nxt[i])
      if (dep[to[i]] == -1 && cap[i]) {
        dep[to[i]] = dep[u] + 1;
        qu[re++] = to[i];
      }
  }
  return ~dep[T];
}
int dfs(int x, int lim) {
  if (x == T || !lim) return lim;
  int f, flow = 0;
  for (int &i = cur[x]; i; i = nxt[i])
    if (dep[to[i]] == dep[x] + 1 && (f = dfs(to[i], min(lim, cap[i])))) {
      flow += f;
      lim -= f;
      cap[i] -= f;
      cap[i ^ 1] += f;
      if (!lim) break;
    }
  return flow;
}
void solve() {
  read(r);
  read(c);
  n = r * c;
  SS = n + 1;
  TT = SS + 1;
  S = TT + 1;
  T = S + 1;
  memset(head, 0, n + 5 << 2);
  memset(in, 0, sizeof in);
  cnt = 1;
  add(TT, SS, n);
  for (int i = 1; i <= n; ++i) read(s[i]);
  for (int x = 1; x <= r; ++x)
    for (int y = 1; y <= c; ++y) {
      int now = id(x, y);
      if (x + y & 1) {
        if (check(x, y))
          add(SS, now, 1);
        else {
          --in[SS];
          ++in[now];
        }
        if (x > 1 && s[now] == s[now - c]) add(now, now - c, 1);
        if (x < r && s[now] == s[now + c]) add(now, now + c, 1);
        if (y > 1 && s[now] == s[now - 1]) add(now, now - 1, 1);
        if (y < c && s[now] == s[now + 1]) add(now, now + 1, 1);
      } else {
        if (check(x, y))
          add(now, TT, 1);
        else {
          --in[now];
          ++in[TT];
        }
      }
    }
  for (int i = 1; i <= TT; ++i)
    if (in[i] > 0) {
      add(S, i, in[i]);
      maxf += in[i];
    } else if (in[i] < 0)
      add(i, T, -in[i]);
  while (bfs()) maxf -= dfs(S, maxf);
  if (maxf) {
    puts("NO");
    return;
  }
  for (int i = 2; i < cnt; i += 2)
    if (!cap[i]) {
      int Azusa = to[i], Mrsrz = to[i ^ 1];
      if (Azusa > Mrsrz) swap(Azusa, Mrsrz);
      if (Mrsrz > n) continue;
      if (Mrsrz - Azusa == c) {
        dir[Azusa] = 'D';
        dir[Mrsrz] = 'U';
      } else if (Mrsrz - Azusa == 1) {
        dir[Azusa] = 'R';
        dir[Mrsrz] = 'L';
      }
      val[Azusa] = 1;
      val[Mrsrz] = s[Mrsrz] - 1;
    }
  puts("YES");
  for (int i = 1; i <= n; ++i) printf("%d%c", val[i], " \n"[!(i % c)]);
  for (int i = 1; i <= n; ++i) {
    putchar(dir[i]);
    putchar(" \n"[!(i % c)]);
  }
}
int Test;
int main() {
  read(Test);
  while (Test--) solve();
}