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;
std::mt19937 rnd(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int DX[] = {-1, 0, +1, 0}, DY[] = {0, +1, 0, -1};
const char DC[] = {'U', 'R', 'D', 'L'};
struct MaxFlow {
  int n;
  vector<int> ghead, gnxt, gto;
  vector<long long> gcap;
  vector<int> d;
  queue<int> q;
  vector<int> cur;
  void init(int _n) {
    n = _n;
    ghead = vector<int>(n, -1);
    gnxt = gto = vector<int>();
    gcap = vector<long long>();
  }
  int addedgewithflow(int a, int b, long long cap, long long flow) {
    gnxt.push_back(ghead[a]);
    ghead[a] = ((int)(gnxt).size()) - 1;
    gto.push_back(b);
    gcap.push_back(cap - flow);
    gnxt.push_back(ghead[b]);
    ghead[b] = ((int)(gnxt).size()) - 1;
    gto.push_back(a);
    gcap.push_back(flow);
    return ((int)(gnxt).size()) - 2;
  }
  int addedge(int a, int b, long long cap) {
    return addedgewithflow(a, b, cap, 0);
  }
  long long dfs(int at, int t, long long rem) {
    long long ret = 0;
    if (at == t) return rem;
    if (d[at] >= d[t]) return 0;
    for (; cur[at] != -1; cur[at] = gnxt[cur[at]]) {
      int to = gto[cur[at]];
      long long cap = gcap[cur[at]];
      if (d[to] != d[at] + 1 || cap == 0) continue;
      long long now = dfs(to, t, min(cap, rem));
      rem -= now;
      ret += now;
      if (gcap[cur[at]] != LLONG_MAX) gcap[cur[at]] -= now;
      if (gcap[cur[at] ^ 1] != LLONG_MAX) gcap[cur[at] ^ 1] += now;
      if (rem == 0) return ret;
    }
    return ret;
  }
  long long solve(int s, int t) {
    long long ret = 0;
    while (true) {
      d = vector<int>(n, INT_MAX);
      q = queue<int>();
      d[s] = 0, q.push(s);
      while (!q.empty() && d[t] == INT_MAX) {
        int at = q.front();
        q.pop();
        for (int x = ghead[at]; x != -1; x = gnxt[x]) {
          int to = gto[x];
          if (gcap[x] == 0 || d[to] != INT_MAX) continue;
          d[to] = d[at] + 1, q.push(to);
        }
      }
      if (d[t] == INT_MAX) return ret;
      cur = ghead;
      ret += dfs(s, t, LLONG_MAX);
    }
  }
  long long getflow(int x) { return gcap[x ^ 1]; }
};
struct MaxFlowWithEdgeDemands {
  struct E {
    int a, b;
    long long lo, hi;
    E() {}
    E(int a, int b, long long lo, long long hi) : a(a), b(b), lo(lo), hi(hi) {}
  };
  int n;
  vector<E> e;
  MaxFlow feasible;
  MaxFlow maximal;
  void init(int _n) {
    n = _n;
    e = vector<E>();
  }
  int addedge(int a, int b, long long lo, long long hi) {
    e.push_back(E(a, b, lo, hi));
    return ((int)(e).size()) - 1;
  }
  pair<bool, long long> solve(int s, int t) {
    vector<long long> excess(n, 0);
    for (int i = (0); i < (((int)(e).size())); ++i)
      excess[e[i].a] += e[i].lo, excess[e[i].b] -= e[i].lo;
    long long sumexcess = 0;
    for (int i = (0); i < (n); ++i)
      if (excess[i] > 0) sumexcess += excess[i];
    int ss = n, tt = n + 1;
    feasible.init(n + 2);
    for (int i = (0); i < (((int)(e).size())); ++i)
      feasible.addedge(e[i].a, e[i].b, e[i].hi - e[i].lo);
    feasible.addedge(t, s, sumexcess);
    for (int i = (0); i < (n); ++i)
      if (excess[i] < 0)
        feasible.addedge(ss, i, -excess[i]);
      else if (excess[i] > 0)
        feasible.addedge(i, tt, +excess[i]);
    if (feasible.solve(ss, tt) != sumexcess) return make_pair(false, LLONG_MIN);
    long long feasibleflow = feasible.getflow(2 * ((int)(e).size()));
    maximal.init(n);
    for (int i = (0); i < (((int)(e).size())); ++i) {
      long long cur = feasible.getflow(2 * i);
      maximal.addedgewithflow(e[i].a, e[i].b, e[i].hi - e[i].lo, cur);
    }
    long long maximalflow = 0;
    return make_pair(true, feasibleflow + maximalflow);
  }
  long long getflow(int x) { return e[x].lo + maximal.getflow(2 * x); }
};
int h, w;
vector<vector<int>> sumreach;
vector<vector<int>> ansval;
vector<string> ansdir;
MaxFlowWithEdgeDemands g;
bool solve() {
  int sid = h * w, tid = h * w + 1;
  g.init(h * w + 2);
  vector<pair<int, pair<pair<int, int>, int>>> opt;
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y) {
      bool loweradj = false;
      for (int k = (0); k < (4); ++k) {
        int nx = x + DX[k], ny = y + DY[k];
        if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
        if (sumreach[nx][ny] < sumreach[x][y]) loweradj = true;
      }
      int id = x * w + y;
      if ((x + y) % 2 == 0) {
        g.addedge(sid, id, loweradj ? 0 : 1, 1);
      } else {
        g.addedge(id, tid, loweradj ? 0 : 1, 1);
      }
    }
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y)
      if ((x + y) % 2 == 0)
        for (int k = (0); k < (4); ++k) {
          int nx = x + DX[k], ny = y + DY[k];
          if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
          if (sumreach[x][y] == sumreach[nx][ny]) {
            int idx = g.addedge(x * w + y, nx * w + ny, 0, 1);
            opt.push_back(make_pair(idx, make_pair(make_pair(x, y), k)));
          }
        }
  if (!g.solve(sid, tid).first) return false;
  ansval = vector<vector<int>>(h, vector<int>(w, 0));
  ansdir = vector<string>(h, string(w, '?'));
  for (int i = (0); i < (((int)(opt).size())); ++i) {
    int idx = opt[i].first, x = opt[i].second.first.first,
        y = opt[i].second.first.second, k = opt[i].second.second,
        nx = x + DX[k], ny = y + DY[k];
    long long cur = g.getflow(idx);
    if (cur == 0) continue;
    assert(cur == 1);
    assert(ansdir[x][y] == '?' && ansdir[nx][ny] == '?');
    assert(sumreach[x][y] == sumreach[nx][ny]);
    ansdir[x][y] = DC[k], ansdir[nx][ny] = DC[k ^ 2];
    ansval[x][y] = 1, ansval[nx][ny] = sumreach[x][y] - 1;
  }
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y)
      if (ansdir[x][y] == '?') {
        bool found = false;
        for (int k = (0); k < (4); ++k) {
          int nx = x + DX[k], ny = y + DY[k];
          if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
          if (sumreach[nx][ny] < sumreach[x][y]) {
            ansdir[x][y] = DC[k],
            ansval[x][y] = sumreach[x][y] - sumreach[nx][ny];
            found = true;
            break;
          }
        }
        assert(found);
      }
  return true;
}
void run() {
  scanf("%d%d", &h, &w);
  sumreach = vector<vector<int>>(h, vector<int>(w));
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y) scanf("%d", &sumreach[x][y]);
  if (!solve()) {
    printf("NO\n");
    return;
  }
  printf("YES\n");
  for (int x = (0); x < (h); ++x) {
    for (int y = (0); y < (w); ++y) {
      if (y != 0) printf(" ");
      printf("%d", ansval[x][y]);
    }
    puts("");
  }
  for (int x = (0); x < (h); ++x) {
    for (int y = (0); y < (w); ++y) {
      if (y != 0) printf(" ");
      printf("%c", ansdir[x][y]);
    }
    puts("");
  }
}
int main() {
  int ncase;
  scanf("%d", &ncase);
  for (int i = (1); i <= (ncase); ++i) run();
  return 0;
}