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 optimize("Ofast", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
#pragma GCC target("avx2")
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
const long long MOD2 = (long long)998244353 * (long long)998244353;
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 998244353) {
  x += y;
  if (x >= mod) x -= mod;
  if (x < 0) x += mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
class MaxFlow {
 public:
  int cap[1200000], flow[1200000];
  int to[1200000], prev[1200000], last[110000], used[110000], level[110000];
  int V, E;
  MaxFlow() {
    V = 0;
    E = 0;
    memset(last, -1, sizeof last);
  }
  void add_edge(int x, int y, int f) {
    cap[E] = f;
    flow[E] = 0;
    to[E] = y;
    prev[E] = last[x];
    last[x] = E;
    E++;
    cap[E] = 0;
    flow[E] = 0;
    to[E] = x;
    prev[E] = last[y];
    last[y] = E;
    E++;
  }
  bool bfs(int s, int t) {
    memset(level, -1, sizeof level);
    queue<int> q;
    q.push(s);
    level[s] = 0;
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      for (int i = last[x]; i >= 0; i = prev[i])
        if (level[to[i]] == -1 && cap[i] > flow[i]) {
          q.push(to[i]);
          level[to[i]] = level[x] + 1;
        }
    }
    return (level[t] != -1);
  }
  int dfs(int v, int t, int f) {
    if (v == t) return f;
    for (int i = used[v]; i >= 0; used[v] = i = prev[i])
      if (level[to[i]] > level[v] && cap[i] > flow[i]) {
        int tmp = dfs(to[i], t, min(f, cap[i] - flow[i]));
        if (tmp > 0) {
          flow[i] += tmp;
          flow[i ^ 1] -= tmp;
          return tmp;
        }
      }
    return 0;
  }
  vector<pair<int, int>> positive_edges() {
    vector<pair<int, int>> ans;
    for (int(i) = 0; (i) < (int)(V); (i)++)
      for (int j = last[i]; j >= 0; j = prev[j])
        if (cap[j] - flow[j] > 0) ans.push_back(make_pair(i, to[j]));
    return ans;
  }
  int maxflow(int s, int t) {
    while (bfs(s, t)) {
      for (int i = s; i <= t; i++) used[i] = last[i];
      while (dfs(s, t, (1 << 29)) != 0)
        ;
    }
    int ans = 0;
    for (int i = last[s]; i >= 0; i = prev[i]) ans += flow[i];
    return ans;
  }
  void init(int n, int es) {
    V = n;
    E = 0;
    for (int(i) = 0; (i) < (int)(V); (i)++) last[i] = -1;
    for (int(i) = 0; (i) < (int)(V); (i)++) {
      used[i] = 0;
      level[i] = 0;
    }
    for (int(i) = 0; (i) < (int)(es); (i)++) {
      cap[i] = flow[i] = to[i] = prev[i] = 0;
    }
  }
} mf;
int gid(int i, int j) { return i * m + j + 1 + 2; }
void fmain(int tid) {
  scanf("%d%d", &n, &m);
  mf.V = n * m + 5;
  vector<vector<int>> a(n, vector<int>(m));
  for (int(i) = 0; (i) < (int)(n); (i)++)
    for (int(j) = 0; (j) < (int)(m); (j)++) scanf("%d", &a[i][j]);
  int S = 1, s = 2, t = n * m + 3, T = t + 1;
  auto isMan = [&](int i, int j) {
    for (int(k) = 0; (k) < (int)(4); (k)++) {
      int x = dx[k] + i, y = dy[k] + j;
      if (x >= 0 && x < n && y >= 0 && y < m) {
        if (a[x][y] < a[i][j]) return 0;
      }
    }
    return 1;
  };
  vector<int> in(T + 2, 0);
  vector<tuple<int, int, int, int, int>> vpt;
  for (int(i) = 0; (i) < (int)(n); (i)++)
    for (int(j) = 0; (j) < (int)(m); (j)++) {
      int w = (i + j) & 1;
      int x = gid(i, j);
      if (i + 1 < n && a[i + 1][j] == a[i][j]) {
        int u = x;
        int v = gid(i + 1, j);
        if (w) swap(u, v);
        mf.add_edge(u, v, 1);
        vpt.push_back({i, j, i + 1, j, mf.E - 2});
      }
      if (j + 1 < m && a[i][j + 1] == a[i][j]) {
        int u = x;
        int v = gid(i, j + 1);
        if (w) swap(u, v);
        mf.add_edge(u, v, 1);
        vpt.push_back({i, j, i, j + 1, mf.E - 2});
      }
      int high = 1, low = isMan(i, j);
      if (w == 0) {
        mf.add_edge(s, x, high - low);
        in[x] += low;
        in[s] -= low;
      } else {
        mf.add_edge(x, t, high - low);
        in[t] += low;
        in[x] -= low;
      }
    }
  int flSum = 0;
  for (int(i) = 1; (i) <= (int)(T); (i)++) {
    if (in[i] > 0) {
      mf.add_edge(S, i, in[i]);
      flSum += in[i];
    } else if (in[i] < 0)
      mf.add_edge(i, T, -in[i]);
  }
  mf.add_edge(t, s, (1 << 30));
  int A = mf.maxflow(S, T);
  if (A != flSum) {
    puts("NO");
  } else {
    puts("YES");
    vector<vector<int>> ans(n, vector<int>(m, 0));
    vector<vector<char>> ad(n, vector<char>(m, '.'));
    for (auto& p : vpt) {
      int cx, cy, tx, ty, id;
      tie(cx, cy, tx, ty, id) = p;
      int zz = 1 - (mf.cap[id] - mf.flow[id]);
      if (zz == 1) {
        ans[cx][cy] = a[cx][cy] - 1;
        ans[tx][ty] = 1;
        if (cx + 1 == tx) {
          ad[cx][cy] = 'D';
          ad[tx][ty] = 'U';
        } else {
          ad[cx][cy] = 'R';
          ad[tx][ty] = 'L';
        }
      }
    }
    for (int(i) = 0; (i) < (int)(n); (i)++)
      for (int(j) = 0; (j) < (int)(m); (j)++)
        if (ad[i][j] == '.') {
          for (int(k) = 0; (k) < (int)(4); (k)++) {
            int x = dx[k] + i, y = dy[k] + j;
            if (x >= 0 && x < n && y >= 0 && y < m) {
              if (a[x][y] < a[i][j]) {
                ans[i][j] = a[i][j] - a[x][y];
                ad[i][j] = direc[k];
                break;
              }
            }
          }
        }
    for (int(i) = 0; (i) < (int)(n); (i)++) {
      for (int(j) = 0; (j) < (int)(m); (j)++) printf("%d ", ans[i][j]);
      puts("");
    }
    for (int(i) = 0; (i) < (int)(n); (i)++) {
      for (int(j) = 0; (j) < (int)(m); (j)++) printf("%c ", ad[i][j]);
      puts("");
    }
  }
  mf.init(mf.V, mf.E);
}
int main() {
  int t = 1;
  scanf("%d", &t);
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}