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 dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
const char ans_chr[] = {'R', 'L', 'D', 'U'};
const int N = 300005;
struct edge {
  int to, next, f;
} e[N * 10];
vector<int> v[N];
int ans[N], dif[N], a[N], eid[N];
int dis[N], q[N], head[N], deg[N];
int id, cnt, tot, nd, S, T, SS, TT, n, m;
void add(int x, int y, int f) {
  e[++tot] = (edge){y, head[x], f};
  head[x] = tot;
  e[++tot] = (edge){x, head[y], 0};
  head[y] = tot;
}
void add(int x, int y, int l, int h) {
  if (l == h) {
    deg[x] -= l;
    deg[y] += l;
  } else {
    add(x, y, h);
  }
}
bool bfs(int S, int T) {
  int h = 0, t = 1;
  for (int i = (int)(1); i <= (int)(nd); i++) dis[i] = -1;
  q[1] = S;
  dis[S] = 0;
  while (h != t) {
    int x = q[++h];
    for (int i = head[x]; i; i = e[i].next)
      if (dis[e[i].to] == -1 && e[i].f) {
        dis[e[i].to] = dis[x] + 1;
        if (e[i].to == T) return 1;
        q[++t] = e[i].to;
      }
  }
  return 0;
}
int dfs(int x, int T, int flow) {
  if (x == T) return flow;
  int k, rest = flow;
  for (int i = head[x]; i && rest; i = e[i].next)
    if (dis[e[i].to] == dis[x] + 1 && e[i].f) {
      k = dfs(e[i].to, T, min(rest, e[i].f));
      e[i].f -= k;
      e[i ^ 1].f += k;
      rest -= k;
    }
  if (rest) dis[x] = -1;
  return flow - rest;
}
int check() {
  int sum = 0;
  for (int i = (int)(1); i <= (int)(T); i++)
    if (deg[i] < 0) sum -= deg[i];
  for (; bfs(SS, TT); sum -= dfs(SS, TT, 1 << 30))
    ;
  return sum == 0;
}
void solve() {
  nd = 0;
  cnt = 0;
  tot = 1;
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(n); i++) v[i].resize(m + 2);
  for (int i = (int)(1); i <= (int)(n); i++)
    for (int j = (int)(1); j <= (int)(m); j++) v[i][j] = ++nd;
  S = ++nd;
  T = ++nd;
  SS = ++nd;
  TT = ++nd;
  for (int i = (int)(1); i <= (int)(nd); i++) deg[i] = head[i] = 0;
  for (int i = (int)(1); i <= (int)(n); i++)
    for (int j = (int)(1); j <= (int)(m); j++) scanf("%d", &a[v[i][j]]);
  for (int i = (int)(1); i <= (int)(n); i++)
    for (int j = (int)(1); j <= (int)(m); j++) {
      int flag = 1;
      for (int k = (int)(0); k <= (int)(3); k++) {
        int x = i + dx[k], y = j + dy[k];
        if (x < 1 || x > n || y < 1 || y > m) continue;
        if (a[v[x][y]] < a[v[i][j]]) flag = 0;
        if (a[v[x][y]] == a[v[i][j]] && (i + j) % 2 == 1)
          add(v[i][j], v[x][y], 0, 1);
      }
      if ((i + j) % 2 == 1)
        add(S, v[i][j], flag, 1);
      else
        add(v[i][j], T, flag, 1);
      if (flag == 1)
        eid[v[i][j]] = 0;
      else
        eid[v[i][j]] = tot - 1;
    }
  add(T, S, 1 << 30);
  for (int i = (int)(1); i <= (int)(T); i++)
    if (deg[i] > 0)
      add(SS, i, deg[i]);
    else
      add(i, TT, -deg[i]);
  if (!check()) return puts("NO"), void(0);
  for (int i = (int)(1); i <= (int)(n); i++)
    for (int j = (int)(1); j <= (int)(m); j++)
      if (e[eid[v[i][j]]].f) {
        for (int k = (int)(0); k <= (int)(3); k++) {
          int x = i + dx[k], y = j + dy[k];
          if (x < 1 || x > n || y < 1 || y > m) continue;
          if (a[v[x][y]] < a[v[i][j]]) {
            ans[v[i][j]] = k;
            dif[v[i][j]] = a[v[i][j]] - a[v[x][y]];
          }
        }
      } else {
        int mat = -1;
        for (int ii = head[v[i][j]]; ii; ii = e[ii].next)
          if (e[ii].to != T && e[ii].to != S && (e[ii].f + i + j + 1) % 2 == 0)
            mat = e[ii].to;
        for (int k = (int)(0); k <= (int)(3); k++) {
          int x = i + dx[k], y = j + dy[k];
          if (x < 1 || x > n || y < 1 || y > m) continue;
          if (v[x][y] == mat) ans[v[i][j]] = k;
        }
        dif[v[i][j]] = ((i + j) % 2 == 1 ? 1 : a[v[i][j]] - 1);
      }
  puts("YES");
  for (int i = (int)(1); i <= (int)(n); i++) {
    for (int j = (int)(1); j <= (int)(m); j++) printf("%d ", dif[v[i][j]]);
    puts("");
  }
  for (int i = (int)(1); i <= (int)(n); i++) {
    for (int j = (int)(1); j <= (int)(m); j++)
      printf("%c ", ans_chr[ans[v[i][j]]]);
    puts("");
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) solve();
}