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; }
template <typename C, typename R = C>
struct MaxFlow {
  static const C oo = std::numeric_limits<C>::max();
  struct edge {
    int dst;
    int rev;
    C cap, flowp;
    edge(int src, int dst, int rev, C cap, int flowp)
        : dst(dst), rev(rev), cap(cap), flowp(flowp) {}
  };
  MaxFlow(int n) : adj(n), que(n), level(n), edge_pos(n), in(n), flow_id(0) {}
  int add_edge(int src, int dst, C cap, C rcap = 0) {
    adj[src].emplace_back(src, dst, (int)adj[dst].size(), cap, flow_id++);
    if (src == dst) adj[src].back().rev++;
    adj[dst].emplace_back(dst, src, (int)adj[src].size() - 1, rcap, flow_id++);
    return (int)adj[src].size() - 1 - (src == dst);
  }
  inline bool side_of_S(int u) { return level[u] == -1; }
  R max_flow(int source, int sink, vector<C> &flow_e) {
    R flow = 0;
    while (true) {
      int front = 0, back = 0;
      std::fill(level.begin(), level.end(), -1);
      for (level[que[back++] = sink] = 0; front < back && level[source] == -1;
           ++front) {
        int u = que[front];
        for (const edge &e : adj[u])
          if (level[e.dst] == -1 && flow_e[rev(e).flowp] < rev(e).cap)
            level[que[back++] = e.dst] = 1 + level[u];
      }
      if (level[source] == -1) break;
      std::fill(edge_pos.begin(), edge_pos.end(), 0);
      std::function<C(int, C)> find_path = [&](int from, C res) {
        if (from == sink) return res;
        for (int &ept = edge_pos[from]; ept < (int)adj[from].size(); ++ept) {
          edge &e = adj[from][ept];
          if (flow_e[e.flowp] == e.cap || level[e.dst] + 1 != level[from])
            continue;
          C push = find_path(e.dst, std::min(res, e.cap - flow_e[e.flowp]));
          if (push > 0) {
            flow_e[e.flowp] += push;
            flow_e[rev(e).flowp] -= push;
            if (flow_e[e.flowp] == e.cap) ++ept;
            return push;
          }
        }
        return static_cast<C>(0);
      };
      for (C f; (f = find_path(source, oo)) > 0;) flow += f;
    }
    return flow;
  }
  void addLimEdge(int u, int v, int low, int high) {
    in[v] += low;
    in[u] -= low;
    add_edge(u, v, high - low);
  }
  R initLim(int S, int s, int t, int T, int cusInf) {
    C ssSum = 0;
    for (int i = s; i <= t; i++) {
      if (in[i] < 0)
        add_edge(i, T, -in[i]);
      else if (in[i] > 0) {
        add_edge(S, i, in[i]);
        ssSum += in[i];
      }
    }
    add_edge(t, s, cusInf);
    return ssSum;
  }
  int flow_id;

 private:
  std::vector<std::vector<edge>> adj;
  std::vector<int> que;
  std::vector<int> level;
  std::vector<int> edge_pos;
  std::vector<int> in;
  inline edge &rev(const edge &e) { return adj[e.dst][e.rev]; }
};
int gid(int i, int j) { return i * m + j + 1 + 2; }
void fmain(int tid) {
  scanf("%d%d", &n, &m);
  MaxFlow<int> mf(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<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.addLimEdge(u, v, 0, 1);
        vpt.push_back({i, j, i + 1, j, mf.flow_id - 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.addLimEdge(u, v, 0, 1);
        vpt.push_back({i, j, i, j + 1, mf.flow_id - 2});
      }
      int high = 1, low = isMan(i, j);
      if (w == 0) {
        mf.addLimEdge(s, x, low, high);
      } else {
        mf.addLimEdge(x, t, low, high);
      }
    }
  int flSum = mf.initLim(S, s, t, T, (1 << 30));
  vector<int> fls(mf.flow_id);
  int A = mf.max_flow(S, T, fls);
  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 = (fls[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("");
    }
  }
}
int main() {
  int t = 1;
  scanf("%d", &t);
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}