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 maxn = (int)1e6 + 10;
const int mod = (int)1e9 + 7;
const int inf = (1 << 30) - 1;
int n, m, q;
int a[maxn];
int good[maxn];
vector<int> g[maxn];
int p[maxn];
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
char dir[] = {'U', 'D', 'L', 'R'};
int u[maxn];
int T;
int b[maxn];
char c[maxn];
bool dfs(int v) {
  if (u[v] == T) return false;
  u[v] = T;
  for (int to : g[v]) {
    if (p[to] == -1) {
      p[to] = v;
      p[v] = to;
      return true;
    }
  }
  for (int to : g[v]) {
    if (good[p[to]] > 0) {
      p[p[to]] = -1;
      p[to] = v;
      p[v] = to;
      return true;
    }
  }
  for (int to : g[v]) {
    if (dfs(p[to])) {
      p[to] = v;
      p[v] = to;
      return true;
    }
  }
  return false;
}
void solve() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i * m + j];
      good[i * m + j] = 0;
      g[i * m + j].clear();
      p[i * m + j] = -1;
      u[i * m + j] = 0;
    }
  }
  T = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < 4; k++) {
        int x = i + dx[k];
        int y = j + dy[k];
        if (x >= 0 && x < n && y >= 0 && y < m) {
          if (a[i * m + j] > a[x * m + y]) {
            good[i * m + j] = 1;
          } else if (a[i * m + j] == a[x * m + y]) {
            g[i * m + j].emplace_back(x * m + y);
          }
        }
      }
    }
  }
  vector<int> li;
  for (int i = 0; i < n * m; i++) {
    if (good[i] == 0) {
      li.emplace_back(i);
    }
  }
  while (true) {
    int ok = false;
    T++;
    for (int i = 0; i < li.size(); i++) {
      if (p[li[i]] == -1 && dfs(li[i])) {
        ok = true;
      }
    }
    if (!ok) break;
  }
  for (int i = 0; i < n * m; i++) {
    if (good[i]) continue;
    if (p[i] == -1) {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
  for (int i = 0; i < n * m; i++) {
    if (p[i] == -1) {
      for (int k = 0; k < 4; k++) {
        int x = i / m + dx[k];
        int y = i % m + dy[k];
        if (x >= 0 && x < n && y >= 0 && y < m) {
          if (a[i] > a[x * m + y]) {
            b[i] = a[i] - a[x * m + y];
            c[i] = dir[k];
          }
        }
      }
    } else {
      for (int k = 0; k < 4; k++) {
        int x = i / m + dx[k];
        int y = i % m + dy[k];
        if (x >= 0 && x < n && y >= 0 && y < m) {
          if (a[i] == a[x * m + y] && p[i] == x * m + y) {
            if (i < x * m + y) {
              b[i] = 1;
            } else {
              b[i] = a[i] - 1;
            }
            c[i] = dir[k];
          }
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << b[i * m + j] << " ";
    }
    cout << "\n";
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << c[i * m + j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}