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 = 1e5 + 5;
int a[N];
int n, m;
int p[5][2] = {0, 0, -1, 0, 1, 0, 0, 1, 0, -1};
bool lim[N];
int link[N], used[N];
int to[10 * N], lst[N], nxt[10 * N], cnt;
int ans[N];
char d[N];
int C(int x, int y) { return x * m + y; }
pair<int, int> C(int x) {
  return x < 0 | x >= n * m ? make_pair(-1, -1) : make_pair(x / m, x % m);
}
bool dfs(int u, int cas) {
  for (int k = lst[u]; k != 0; k = nxt[k]) {
    int v = to[k];
    if (used[v] != cas) {
      used[v] = cas;
      if (link[v] == -1 || dfs(link[v], cas)) {
        link[u] = v;
        link[v] = u;
        return 1;
      } else {
        if (lim[link[v]] == 0) {
          link[link[v]] = -1;
          link[u] = v;
          link[v] = u;
          return 1;
        }
      }
    }
  }
  return 0;
}
void Add(int u, int v) {
  cnt++, nxt[cnt] = lst[u], to[cnt] = v, lst[u] = cnt;
  cnt++, nxt[cnt] = lst[v], to[cnt] = u, lst[v] = cnt;
}
char T(int x, int y, int xx, int yy) {
  if (yy == y + 1) return 'R';
  if (yy == y - 1) return 'L';
  if (xx == x - 1) return 'U';
  if (xx == x + 1) return 'D';
}
void Find(int u) {
  pair<int, int> cor = C(u);
  int x = cor.first, y = cor.second;
  if (link[u] == -1) {
    for (int k = 1; k <= 4; k++) {
      int xx = x + p[k][0], yy = y + p[k][1];
      if (xx < 0 || xx >= n || yy < 0 || yy >= m || a[C(xx, yy)] >= a[u])
        continue;
      d[u] = T(x, y, xx, yy);
      ans[u] = a[u] - a[C(xx, yy)];
      break;
    }
  } else {
    int xx, yy;
    pair<int, int> corr;
    corr = C(link[u]);
    xx = corr.first, yy = corr.second;
    d[u] = T(x, y, xx, yy);
    if (ans[link[u]])
      ans[u] = a[u] - ans[link[u]];
    else
      ans[u] = 1;
  }
}
int anss[100][100];
void Judge(int x, int y) {
  used[C(x, y)] = 1;
  int xx = x, yy = y;
  if (d[C(x, y)] == 'D') xx++;
  if (d[C(x, y)] == 'L') yy--;
  if (d[C(x, y)] == 'U') xx--;
  if (d[C(x, y)] == 'R') yy++;
  if (used[C(xx, yy)])
    if (anss[xx][yy] != 0)
      anss[x][y] = ans[C(x, y)] + anss[xx][yy];
    else
      anss[x][y] = anss[xx][yy] = ans[C(x, y)] + ans[C(xx, yy)];
  else {
    Judge(xx, yy);
    if (anss[x][y] == 0) anss[x][y] = anss[xx][yy] + ans[C(x, y)];
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d %d", &n, &m);
    for (int i = 0; i <= n * m - 1; i++) link[i] = -1;
    for (int i = 0; i <= n * m - 1; i++) scanf("%d", &a[i]);
    bool ok = 1;
    for (int i = 0; i <= n * m - 1; i++) {
      pair<int, int> xy = C(i);
      bool flag = 0;
      int num = 0;
      for (int k = 1; k <= 4; k++) {
        int x = xy.first + p[k][0], y = xy.second + p[k][1];
        if (x < 0 || x >= n || y < 0 || y >= m || a[C(x, y)] > a[i]) continue;
        flag = 1;
        if (a[C(x, y)] == a[i] && C(x, y) < i)
          Add(C(x, y), i);
        else if (a[C(x, y)] != a[i])
          num++;
      }
      if (!flag) {
        ok = 0;
        break;
      }
      if (num == 0) lim[i] = 1;
    }
    if (!ok) {
      printf("NO\n");
      continue;
    }
    int cas = 0;
    for (int i = 0; i <= n * m - 1; i++) {
      if (!lim[i]) continue;
      if (link[i] == -1 && !dfs(i, ++cas)) {
        ok = 0;
        break;
      }
    }
    if (!ok) {
      printf("NO\n");
      continue;
    }
    for (int i = 0; i <= n * m - 1; i++)
      if (ans[i] == 0) Find(i);
    printf("YES\n");
    for (int i = 0; i <= n - 1; i++) {
      for (int j = 0; j <= m - 1; j++) printf("%d ", ans[C(i, j)]);
      printf("\n");
    }
    for (int i = 0; i <= n - 1; i++) {
      for (int j = 0; j <= m - 1; j++) printf("%c ", d[C(i, j)]);
      printf("\n");
    }
    cnt = 0;
    for (int i = 0; i <= n * m - 1; i++)
      lim[i] = ans[i] = d[i] = used[i] = lst[i] = 0, link[i] = -1;
  }
}