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 ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int N = 1e5 + 10, M = 2e6 + 10, dir[4][2] = {0, 1, 0, -1, 1, 0, -1, 0};
struct Edge {
  int v, next, w;
} e[M];
int head[N], cnt = 1, S, T, dep[N], cur[N], CASE, n, m;
inline void add(int u, int v, int w) {
  e[++cnt] = (Edge){v, head[u], w};
  head[u] = cnt;
}
inline void Add(int u, int v, int w) {
  add(u, v, w);
  add(v, u, 0);
}
queue<int> q;
inline bool bfs() {
  memset(dep, 0, sizeof(int) * (T + 4));
  while (!q.empty()) q.pop();
  dep[S] = 1;
  q.push(S);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = e[i].next) {
      int v = e[i].v;
      if (!dep[v] && e[i].w) {
        dep[v] = dep[u] + 1;
        q.push(v);
        if (v == T) {
          memcpy(cur, head, sizeof(int) * (T + 4));
          return 1;
        }
      }
    }
  }
  return 0;
}
inline int dfs(int x, int flow) {
  if (x == T) return flow;
  int ret = 0;
  for (int& i = cur[x]; i; i = e[i].next) {
    int v = e[i].v;
    if (dep[v] == dep[x] + 1 && e[i].w) {
      int u = dfs(v, ((flow - ret) < (e[i].w) ? (flow - ret) : (e[i].w)));
      e[i].w -= u;
      e[i ^ 1].w += u;
      if ((ret += u) == flow) break;
    }
  }
  return ret;
}
inline int id(int i, int j) { return (i * m + j + 1); }
int main() {
  CASE = read();
  while (CASE--) {
    cnt = 1;
    memset(head, 0, sizeof(head));
    n = read();
    m = read();
    vector<vector<int> > pot(n, vector<int>(m));
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) pot[i][j] = read();
    T = n * m + 1;
    int SS = n * m + 2, TT = n * m + 3, num = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) {
        int cnt = 0;
        for (int k = 0; k < 4; k++) {
          int x = i + dir[k][0], y = j + dir[k][1];
          cnt += x >= 0 && y >= 0 && x < n && y < m && pot[x][y] < pot[i][j];
        }
        if ((i + j) & 1) {
          if (cnt)
            Add(SS, id(i, j), 1);
          else {
            ++num;
            Add(S, id(i, j), 1);
            Add(SS, T, 1);
          }
          for (int k = 0; k < 4; k++) {
            int x = i + dir[k][0], y = j + dir[k][1];
            if (x >= 0 && y >= 0 && x < n && y < m && pot[x][y] == pot[i][j])
              Add(id(i, j), id(x, y), 1);
          }
        } else {
          if (cnt)
            Add(id(i, j), TT, 1);
          else {
            ++num;
            Add(S, TT, 1);
            Add(id(i, j), T, 1);
          }
        }
      }
    Add(TT, SS, 1e9);
    int ret = 0;
    while (bfs()) ret += dfs(S, 1e9);
    if (ret != num)
      puts("NO");
    else {
      puts("YES");
      vector<vector<int> > ans(n, vector<int>(m));
      vector<vector<char> > dr(n, vector<char>(m));
      for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
          if ((i + j) & 1)
            for (int p = head[id(i, j)]; p; p = e[p].next) {
              int u = e[p].v;
              if (u != S && u != T && u != SS && u != TT && !e[p].w) {
                int x = (u - 1) / m, y = (u - 1) % m;
                ans[i][j] = 1;
                ans[x][y] = pot[x][y] - 1;
                switch ((x - i) * 2 + (y - j)) {
                  case -2:
                    dr[i][j] = 'U';
                    dr[x][y] = 'D';
                    break;
                  case -1:
                    dr[i][j] = 'L';
                    dr[x][y] = 'R';
                    break;
                  case 1:
                    dr[i][j] = 'R';
                    dr[x][y] = 'L';
                    break;
                  case 2:
                    dr[i][j] = 'D';
                    dr[x][y] = 'U';
                    break;
                }
              }
            }
      for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
          if (!ans[i][j])
            for (int k = 0; k < 4; k++) {
              int x = i + dir[k][0], y = j + dir[k][1];
              if (x >= 0 && y >= 0 && x < n && y < m && pot[x][y] < pot[i][j]) {
                dr[i][j] = "RLDU"[k];
                ans[i][j] = pot[i][j] - pot[x][y];
                break;
              }
            }
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          write(ans[i][j]);
          printf(" ");
        }
        puts("");
      }
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          printf("%c", (char)(dr[i][j]));
          printf(" ");
        }
        puts("");
      }
    }
  }
  return 0;
}