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;
using namespace std;
const int _ = 1e5 + 7, __ = 2e6 + 7;
struct Edge {
  int end, upEd, f;
} Ed[__];
int head[_], cntEd = 1, S, T;
void addEd(int a, int b, int c) {
  Ed[++cntEd] = (Edge){b, head[a], c};
  head[a] = cntEd;
}
void addE(int a, int b, int c) {
  addEd(a, b, c);
  addEd(b, a, 0);
}
int dep[_], cur[_];
queue<int> q;
bool bfs() {
  memset(dep, 0, sizeof(int) * (T + 4));
  while (!q.empty()) q.pop();
  dep[S] = 1;
  q.push(S);
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    for (int i = head[t]; i; i = Ed[i].upEd)
      if (!dep[Ed[i].end] && Ed[i].f) {
        dep[Ed[i].end] = dep[t] + 1;
        q.push(Ed[i].end);
        if (Ed[i].end == T) {
          memcpy(cur, head, sizeof(int) * (T + 4));
          return 1;
        }
      }
  }
  return 0;
}
int dfs(int x, int mn) {
  if (x == T) return mn;
  int sum = 0;
  for (int &i = cur[x]; i; i = Ed[i].upEd)
    if (dep[Ed[i].end] == dep[x] + 1 && Ed[i].f) {
      int t = dfs(Ed[i].end, min(mn - sum, Ed[i].f));
      Ed[i].f -= t;
      Ed[i ^ 1].f += t;
      if ((sum += t) == mn) break;
    }
  return sum;
}
const int dir[4][2] = {0, 1, 0, -1, 1, 0, -1, 0};
int CASE, N, M;
int main() {
  ios::sync_with_stdio(0);
  for (cin >> CASE; CASE; --CASE) {
    cntEd = 1;
    memset(head, 0, sizeof(head));
    cin >> N >> M;
    vector<vector<int> > pot(N, vector<int>(M));
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < M; ++j) cin >> pot[i][j];
    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)
            addE(SS, ((i)*M + (j) + 1), 1);
          else {
            ++num;
            addE(S, ((i)*M + (j) + 1), 1);
            addE(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])
              addE(((i)*M + (j) + 1), ((x)*M + (y) + 1), 1);
          }
        } else if (cnt)
          addE(((i)*M + (j) + 1), TT, 1);
        else {
          ++num;
          addE(S, TT, 1);
          addE(((i)*M + (j) + 1), T, 1);
        }
      }
    addE(TT, SS, 1e9);
    int sum = 0;
    while (bfs()) sum += dfs(S, 1e9);
    if (sum != num)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      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[((i)*M + (j) + 1)]; p; p = Ed[p].upEd)
              if (Ed[p].end != S && Ed[p].end != T && Ed[p].end != SS &&
                  Ed[p].end != TT && !Ed[p].f) {
                int t = Ed[p].end, x = (t - 1) / M, y = (t - 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) cout << ans[i][j] << " \n"[j == M - 1];
      for (int i = 0; i < N; ++i)
        for (int j = 0; j < M; ++j) cout << dr[i][j] << " \n"[j == M - 1];
    }
  }
  return 0;
}