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>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int N = 200005, M = 2E6 + 5, DX[4] = {0, 1, 0, -1}, DY[4] = {1, 0, -1, 0};
int te, n, m, a[N], aw[N];
char ad[N];
struct flow_demands {
  vector<pair<int, int>> adj[N];
  int s, t, n, cnt, dem[N], cap[M];
  int sum, lv[N], ptr[N];
  void init(int _n) {
    s = 0;
    t = 1;
    n = _n;
    cnt = 0;
    sum = 0;
    for (int i = 0; i <= n + 4; i++) {
      adj[i].clear();
      dem[i] = 0;
    }
  }
  void add_edge(int u, int v, int d, int c) {
    adj[u].push_back({v, cnt});
    dem[u] += d;
    cap[cnt++] = c - d;
    adj[v].push_back({u, cnt});
    dem[v] -= d;
    cap[cnt++] = 0;
  }
  void normalize() {
    add_edge(t, s, 0, N);
    s = n + 2;
    t = n + 3;
    for (int i = 0; i < s; i++) {
      if (dem[i] > 0) {
        add_edge(i, t, 0, dem[i]);
        sum += dem[i];
      } else if (dem[i] < 0) {
        add_edge(s, i, 0, -dem[i]);
      }
    }
  }
  bool BFS(int lim) {
    fill(lv, lv + t + 1, -1);
    queue<int> q;
    for (lv[s] = 0, q.push(s); !q.empty(); q.pop()) {
      int u = q.front();
      for (auto [v, ind] : adj[u]) {
        if (lv[v] == -1 && cap[ind] >= lim) {
          lv[v] = lv[u] + 1;
          q.push(v);
        }
      }
    }
    return lv[t] != -1;
  }
  int DFS(int u, int p) {
    if (u == t || p == 0) {
      return p;
    }
    for (; ptr[u] < adj[u].size(); ptr[u]++) {
      auto [v, ind] = adj[u][ptr[u]];
      if (lv[v] != lv[u] + 1) {
        continue;
      }
      if (int np = DFS(v, min(p, cap[ind]))) {
        cap[ind] -= np;
        cap[ind ^ 1] += np;
        return np;
      }
    }
    return 0;
  }
  int flow() {
    int ans = 0;
    for (int i = 17; i >= 0; i--) {
      while (BFS(1 << i)) {
        fill(ptr, ptr + t + 1, 0);
        while (int f = DFS(s, N)) {
          ans += f;
        }
      }
    }
    return ans;
  }
} fl;
int index(int i, int j) { return (i - 1) * n + j; }
pair<int, int> convert(int ind) {
  return {(ind - 1) / n + 1, (ind - 1) % n + 1};
}
char direction(int sx, int sy, int tx, int ty) {
  if (sx == tx) {
    return sy < ty ? 'R' : 'L';
  } else if (sx < tx) {
    return 'D';
  } else {
    return 'U';
  }
}
void solve() {
  cin >> m >> n;
  fl.init(m * n);
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[index(i, j)];
    }
  }
  for (int sx = 1; sx <= m; sx++) {
    for (int sy = 1; sy <= n; sy++) {
      bool chk = true, le = (sx + sy) % 2;
      for (int k = 0; k < 4; k++) {
        int tx = sx + DX[k], ty = sy + DY[k];
        if (tx == 0 || tx > m || ty == 0 || ty > n) {
          continue;
        }
        if (a[index(sx, sy)] == a[index(tx, ty)] && le) {
          fl.add_edge(index(sx, sy) + 1, index(tx, ty) + 1, 0, 1);
        } else if (a[index(sx, sy)] > a[index(tx, ty)]) {
          chk = false;
          aw[index(sx, sy)] = a[index(sx, sy)] - a[index(tx, ty)];
          ad[index(sx, sy)] = direction(sx, sy, tx, ty);
        }
      }
      if (le) {
        fl.add_edge(0, index(sx, sy) + 1, chk, 1);
      } else {
        fl.add_edge(index(sx, sy) + 1, 1, chk, 1);
      }
    }
  }
  fl.normalize();
  if (fl.flow() == fl.sum) {
    cout << "YES\n";
    for (int sx = 1; sx <= m; sx++) {
      for (int sy = 1; sy <= n; sy++) {
        if ((sx + sy) % 2) {
          for (auto [v, ind] : fl.adj[index(sx, sy) + 1]) {
            if (v - 1 >= 1 && v - 1 <= m * n && fl.cap[ind] == 0) {
              auto [tx, ty] = convert(v - 1);
              aw[index(sx, sy)] = 1;
              ad[index(sx, sy)] = direction(sx, sy, tx, ty);
              aw[index(tx, ty)] = a[index(sx, sy)] - 1;
              ad[index(tx, ty)] = direction(tx, ty, sx, sy);
            }
          }
        }
      }
    }
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) {
        cout << aw[index(i, j)] << " \n"[j == n];
      }
    }
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) {
        cout << ad[index(i, j)] << " \n"[j == n];
      }
    }
  } else {
    cout << "NO\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> te;
  while (te--) {
    solve();
  }
}