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 void read(int &x) {
  char c;
  int f = 1;
  while (!isdigit(c = getchar()))
    if (c == '-') f = -1;
  x = (c & 15);
  while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
  x *= f;
}
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
int _, n, m, i, j, k, a[100005], dis[100015], s = 0, t = 100001, ss = 100002,
                                              tt = 100003, l[100015];
int dir[100005], res[100005];
int px[2000005], py[2000005], pdx[2000005], pdy[2000005];
int id(int x, int y) { return (x - 1) * m + y; }
vector<int> bi[100015];
struct ii {
  int y, z;
} e[2000005];
int tot;
void init() {
  int i;
  for ((i) = 1; (i) <= (tot); (i)++) px[i] = py[i] = pdx[i] = pdy[i] = 0;
  tot = 0;
  memset(l, 0, sizeof(l));
  for ((i) = 0; (i) <= (tt); (i)++) bi[i].clear();
}
void add(int x, int y, int z) {
  tot++;
  bi[x].push_back(tot + tot - 2);
  bi[y].push_back(tot + tot - 1);
  e[tot + tot - 2] = (ii){y, z};
  e[tot + tot - 1] = (ii){x, 0};
}
bool bfs(int s, int t) {
  memset(dis, 0x3f, sizeof(dis));
  dis[s] = 0;
  queue<int> qx;
  qx.push(s);
  while (!qx.empty()) {
    int x = qx.front();
    qx.pop();
    for (__typeof((bi[x]).begin()) it = (bi[x]).begin(); it != (bi[x]).end();
         ++it)
      if (e[*it].z && dis[e[*it].y] > dis[x] + 1) {
        dis[e[*it].y] = dis[x] + 1;
        qx.push(e[*it].y);
      }
  }
  return dis[t] < dis[100014];
}
int dfs(int x, int tt, int flw) {
  if (x == tt || !flw) return flw;
  int ans = 0;
  for (__typeof((bi[x]).begin()) it = (bi[x]).begin(); it != (bi[x]).end();
       ++it)
    if (dis[x] + 1 == dis[e[*it].y] && e[*it].z) {
      int t = dfs(e[*it].y, tt, min(flw, e[*it].z));
      ans += t;
      flw -= t;
      e[*it].z -= t;
      e[(*it) ^ 1].z += t;
    }
  if (flw) dis[x] = -1;
  return ans;
}
int dinic(int s, int t) {
  int ans = 0;
  while (bfs(s, t)) {
    ans += dfs(s, t, 0x3f3f3f3f);
  }
  return ans;
}
int main() {
  read(_);
  while (_--) {
    read(n);
    read(m);
    for ((i) = 1; (i) <= (n); (i)++)
      for ((j) = 1; (j) <= (m); (j)++) read(a[id(i, j)]);
    init();
    add(t, s, 0x3f3f3f3f);
    for ((i) = 1; (i) <= (n * m); (i)++) {
      dir[i] = res[i] = 0;
    }
    for ((i) = 1; (i) <= (n); (i)++)
      for ((j) = 1; (j) <= (m); (j)++) {
        bool f = 0;
        for ((k) = 0; (k) < (4); (k)++) {
          int x = i + dx[k], y = j + dy[k];
          if (x < 1 || x > n || y < 1 || y > m) continue;
          if (a[id(i, j)] == a[id(x, y)] && ((i + j) & 1)) {
            add(id(i, j), id(x, y), 1);
            px[tot] = id(i, j);
            py[tot] = id(x, y);
            pdx[tot] = k;
            pdy[tot] = (k ^ 2);
          }
          if (a[id(i, j)] > a[id(x, y)]) {
            dir[id(i, j)] = k;
            res[id(i, j)] = a[id(i, j)] - a[id(x, y)];
            f = 1;
          }
        }
        if ((i + j) & 1) {
          if (!f) {
            l[s]--;
            l[id(i, j)]++;
          } else
            add(s, id(i, j), 1);
        } else {
          if (!f) {
            l[id(i, j)]--;
            l[t]++;
          } else
            add(id(i, j), t, 1);
        }
      }
    int sum = 0, ctot = tot;
    for ((i) = 0; (i) <= (t); (i)++) {
      if (l[i] > 0) {
        add(ss, i, l[i]);
        sum += l[i];
      }
      if (l[i] < 0) {
        add(i, tt, -l[i]);
      }
    }
    int ans = dinic(ss, tt);
    if (ans != sum) {
      puts("NO");
      continue;
    }
    puts("YES");
    for ((i) = (2); (i) <= (ctot); (i)++)
      if (e[i + i - 1].z) {
        dir[px[i]] = pdx[i];
        dir[py[i]] = pdy[i];
        res[px[i]] = 1;
        res[py[i]] = a[py[i]] - 1;
      }
    for ((i) = 1; (i) <= (n); (i)++) {
      for ((j) = 1; (j) <= (m); (j)++) {
        printf("%d%c", res[id(i, j)], (j == m ? '\n' : ' '));
      }
    }
    for ((i) = 1; (i) <= (n); (i)++) {
      for ((j) = 1; (j) <= (m); (j)++) {
        printf("%c%c", dir[id(i, j)]["ULDR"], (j == m ? '\n' : ' '));
      }
    }
  }
  return 0;
}