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;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
const int maxn = 1e5 + 10;
char dir[4] = {'R', 'L', 'D', 'U'};
vector<vector<int> > a, ind, nxt;
pair<int, int> rh[maxn];
vector<int> vect[maxn], pos_undo;
int nxt2[maxn], pos[maxn], n, m, mt[maxn], cnt, r;
bool outside(int x, int y) {
  if (x > n || x < 1 || y > m || y < 1) return true;
  return false;
}
void add_edge(int x, int y) {
  vect[x].push_back(y);
  vect[y].push_back(x);
}
bool srt(int x, int y) { return nxt2[x] < nxt2[y]; }
int kuhn(int x, int tip) {
  if (pos[x]) return 0;
  pos[x] = 1;
  pos_undo.push_back(x);
  for (int i = 0; i < vect[x].size(); i++) {
    int id = vect[x][i];
    if (tip == 1 && nxt2[id] == 1) break;
    if (mt[id] == -1 || kuhn(mt[id], tip)) {
      mt[id] = x;
      mt[x] = id;
      return 1;
    }
  }
  return 0;
}
void random_matching() {
  for (int i = 1; i <= cnt; i++) {
    if (mt[i] != -1) continue;
    if (nxt2[i] != 0) continue;
    for (int j = 0; j < vect[i].size(); j++) {
      int id = vect[i][j];
      if (mt[id] != -1) continue;
      if (nxt2[id] != 0) continue;
      mt[i] = id;
      mt[id] = i;
      r -= 2;
      break;
    }
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d %d", &n, &m);
    a.clear();
    nxt.clear();
    ind.clear();
    a.resize(n + 2, vector<int>(m + 2));
    nxt.resize(n + 2, vector<int>(m + 2));
    ind.resize(n + 2, vector<int>(m + 2));
    cnt = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        scanf("%d", &a[i][j]);
        nxt[i][j] = -1;
        nxt2[cnt] = 0;
        ind[i][j] = ++cnt;
        rh[cnt] = {i, j};
        mt[cnt] = -1;
        vect[cnt].clear();
      }
    int fucked = 0;
    r = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        int e = 0;
        for (int k = 0; k < 4; k++) {
          int idx = i + dx[k];
          int idy = j + dy[k];
          if (outside(idx, idy)) continue;
          if (a[idx][idy] < a[i][j]) {
            nxt[i][j] = k;
            nxt2[ind[i][j]] = 1;
          } else if (a[idx][idy] == a[i][j]) {
            e = 1;
            if ((i + j) % 2) add_edge(ind[i][j], ind[idx][idy]);
          }
        }
        if (e == 0 && nxt[i][j] == -1) fucked = 1;
        if (nxt[i][j] == -1) r++;
      }
    if (fucked) {
      printf("NO\n");
      continue;
    }
    for (int i = 1; i <= cnt; i++) sort(vect[i].begin(), vect[i].end(), srt);
    random_matching();
    for (int i = 1; i <= cnt; i++) {
      if (nxt[rh[i].first][rh[i].second] != -1 || mt[i] != -1) continue;
      if (kuhn(i, 1)) r -= 2;
      for (int j = 0; j < pos_undo.size(); j++) pos[pos_undo[j]] = 0;
      pos_undo.clear();
    }
    for (int i = 1; i <= cnt; i++) {
      if (nxt[rh[i].first][rh[i].second] != -1 || mt[i] != -1) continue;
      if (kuhn(i, 0)) r -= 1;
      for (int j = 0; j < pos_undo.size(); j++) pos[pos_undo[j]] = 0;
      pos_undo.clear();
    }
    if (r > 0) {
      printf("NO\n");
      continue;
    }
    printf("YES\n");
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (mt[ind[i][j]] != -1) {
          if ((i + j) % 2)
            printf("%d ", a[i][j] / 2 + (a[i][j] % 2));
          else
            printf("%d ", a[i][j] / 2);
        } else {
          printf("%d ", a[i][j] - a[i + dx[nxt[i][j]]][j + dy[nxt[i][j]]]);
        }
      }
      printf("\n");
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (mt[ind[i][j]] != -1) {
          for (int k = 0; k < 4; k++) {
            int idx = i + dx[k];
            int idy = j + dy[k];
            if (ind[idx][idy] == mt[ind[i][j]]) {
              printf("%c ", dir[k]);
              break;
            }
          }
        } else {
          printf("%c ", dir[nxt[i][j]]);
        }
      }
      printf("\n");
    }
  }
  return 0;
}