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 = 5 + 1e5;
struct Graph {
  struct Edge {
    int to, nxt, c;
  } edge[N * 10];
  int head[N], top;
  void init(int n) { memset(head, -1, sizeof(int) * (n + 1)), top = -1; }
  Graph() { memset(head, -1, sizeof(head)), top = -1; }
  inline void add(int x, int y, int k) {
    edge[++top] = (Edge){y, head[x], k};
    head[x] = top;
  }
} G;
inline void add2(int x, int y, int k) {
  G.add(x, y, k);
  G.add(y, x, 0);
}
namespace FLOW {
int iter[N], lev[N], q[N], left, right;
bool bfs(int s, int t, int n) {
  for (int i = 0; i <= n; ++i) lev[i] = 0, iter[i] = G.head[i];
  left = right = 0;
  q[right++] = s;
  lev[s] = 1;
  while (left != right) {
    int x = q[left++];
    for (int j = G.head[x]; ~j; j = G.edge[j].nxt) {
      int y = G.edge[j].to;
      if (G.edge[j].c > 0 && lev[y] == 0) {
        lev[y] = lev[x] + 1;
        q[right++] = y;
      }
    }
  }
  return lev[t] > 0;
}
int dfs(int x, int o, int mi) {
  if (x == o) return mi;
  for (int& j = iter[x]; ~j; j = G.edge[j].nxt) {
    int y = G.edge[j].to;
    if (G.edge[j].c > 0 && lev[y] == lev[x] + 1) {
      int d = dfs(y, o, min(mi, G.edge[j].c));
      if (d > 0) {
        G.edge[j].c -= d;
        G.edge[j ^ 1].c += d;
        return d;
      }
    }
  }
  return 0;
}
int max_flow(int s, int t, int n) {
  int ret = 0, d;
  while (bfs(s, t, n))
    while ((d = dfs(s, t, (int)1e9)) != 0) ret += d;
  return ret;
}
}  // namespace FLOW
const int dx[] = {0, 0, 1, -1}, dy[] = {-1, 1, 0, 0};
const char ch[] = {'L', 'R', 'D', 'U'};
vector<vector<int> > id, a, ans1;
vector<vector<char> > ans2;
int n, m, top_node, s, t, spp;
int check(int x, int y) {
  for (int j = G.head[x]; ~j; j = G.edge[j].nxt) {
    int z = G.edge[j].to;
    if (z == y) return G.edge[j ^ 1].c;
  }
  return 0;
}
int check2(int x, int y) {
  for (int j = G.head[x]; ~j; j = G.edge[j].nxt) {
    int z = G.edge[j].to;
    if (z == y) return G.edge[j].c;
  }
  return 0;
}
bool check_type(int x, int y) { return (x & 1) ^ (y & 1); }
void get_ans(int x, int y) {
  if (check_type(x, y) && check(id[x][y], spp) ||
      !check_type(x, y) && check2(id[x][y], spp)) {
    for (int asp = 0; asp < 4; ++asp) {
      int x1 = x + dx[asp], y1 = y + dy[asp];
      if (x1 < 0 || x1 >= n || y1 < 0 || y1 >= m) continue;
      if (a[x1][y1] < a[x][y]) {
        ans1[x][y] = a[x][y] - a[x1][y1];
        ans2[x][y] = ch[asp];
        return;
      }
    }
    assert(0);
  } else if ((x & 1) ^ (y & 1)) {
    for (int asp = 0; asp < 4; ++asp) {
      int x1 = x + dx[asp], y1 = y + dy[asp];
      if (x1 < 0 || x1 >= n || y1 < 0 || y1 >= m) continue;
      if (check(id[x][y], id[x1][y1])) {
        ans1[x][y] = 1;
        ans1[x1][y1] = a[x][y] - 1;
        ans2[x][y] = ch[asp];
        ans2[x1][y1] = ch[asp ^ 1];
      }
    }
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &n, &m);
    top_node = 0;
    a.resize(n);
    id.resize(n);
    ans1.resize(n);
    ans2.resize(n);
    G.init(n * m + 5);
    s = ++top_node;
    t = ++top_node;
    spp = ++top_node;
    for (int i = 0; i < n; ++i) {
      a[i].resize(m);
      id[i].resize(m);
      ans1[i].resize(m);
      ans2[i].resize(m);
      for (int j = 0; j < m; ++j) {
        scanf("%d", &a[i][j]);
        id[i][j] = ++top_node;
        if ((i & 1) ^ (j & 1))
          add2(s, id[i][j], 1);
        else
          add2(id[i][j], t, 1);
      }
    }
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j) {
        if ((i & 1) ^ (j & 1)) {
          for (int asp = 0; asp < 4; ++asp) {
            int x = i + dx[asp], y = j + dy[asp];
            if (x < 0 || x >= n || y < 0 || y >= m) continue;
            if (a[i][j] == a[x][y]) {
              add2(id[i][j], id[x][y], 1);
            } else if (a[i][j] > a[x][y]) {
              add2(id[i][j], spp, 1);
            } else
              add2(spp, id[x][y], 1);
          }
        }
      }
    int top = n * m;
    if (top & 1) {
      int x = ++top_node;
      ++top;
      add2(s, x, 1);
      add2(x, spp, 1);
    }
    int key = FLOW::max_flow(s, t, top_node);
    if (key != top / 2)
      puts("NO");
    else {
      puts("YES");
      for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j) get_ans(i, j);
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) printf("%d ", ans1[i][j]);
        puts("");
      }
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) printf("%c ", ans2[i][j]);
        puts("");
      }
    }
  }
  return 0;
}