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;
template <typename flow_t = long long>
struct PushRelabel {
  struct Edge {
    int to, rev;
    flow_t f, c;
  };
  vector<vector<Edge> > g;
  vector<flow_t> ec;
  vector<Edge *> cur;
  vector<vector<int> > hs;
  vector<int> H;
  PushRelabel() {}
  PushRelabel(int n) : g(n), ec(n), cur(n), hs(2 * n), H(n) {}
  void add_edge(int s, int t, flow_t cap, flow_t rcap = 0) {
    if (s == t) return;
    Edge a = {t, (int)g[t].size(), 0, cap};
    Edge b = {s, (int)g[s].size(), 0, rcap};
    g[s].push_back(a);
    g[t].push_back(b);
  }
  void add_flow(Edge &e, flow_t f) {
    Edge &back = g[e.to][e.rev];
    if (!ec[e.to] && f) hs[H[e.to]].push_back(e.to);
    e.f += f;
    e.c -= f;
    ec[e.to] += f;
    back.f -= f;
    back.c += f;
    ec[back.to] -= f;
  }
  flow_t max_flow(int s, int t) {
    int v = g.size();
    H[s] = v;
    ec[t] = 1;
    vector<int> co(2 * v);
    co[0] = v - 1;
    for (int i = 0; i < v; ++i) cur[i] = g[i].data();
    for (auto &e : g[s]) add_flow(e, e.c);
    if (hs[0].size())
      for (int hi = 0; hi >= 0;) {
        int u = hs[hi].back();
        hs[hi].pop_back();
        while (ec[u] > 0)
          if (cur[u] == g[u].data() + g[u].size()) {
            H[u] = 1e9;
            for (auto &e : g[u])
              if (e.c && H[u] > H[e.to] + 1) H[u] = H[e.to] + 1, cur[u] = &e;
            if (++co[H[u]], !--co[hi] && hi < v)
              for (int i = 0; i < v; ++i)
                if (hi < H[i] && H[i] < v) {
                  --co[H[i]];
                  H[i] = v + 1;
                }
            hi = H[u];
          } else if (cur[u]->c && H[u] == H[cur[u]->to] + 1)
            add_flow(*cur[u], min(ec[u], cur[u]->c));
          else
            ++cur[u];
        while (hi >= 0 && hs[hi].empty()) --hi;
      }
    return -ec[s];
  }
};
struct lower_f {
  PushRelabel<> A;
  int success, S_, T_;
  int tot;
  void init(int n) {
    A = PushRelabel<>(n + 3);
    success = 1;
    tot = 0;
    S_ = n + 1;
    T_ = n + 2;
  }
  void insert(int a, int b, int lc, int hc) {
    if (hc < lc) success = 0;
    A.add_edge(S_, b, lc);
    A.add_edge(a, T_, lc);
    A.add_edge(a, b, hc - lc);
    tot += lc;
  }
  int MaxFlow(int S, int T) {
    if (!success) return -1;
    A.add_edge(T, S, (1 << 30));
    int q = A.max_flow(S_, T_);
    return (q == tot ? 1 : -1);
  }
} P;
int n, m, h;
vector<int> a[100201], id[100201], b[100201];
pair<int, int> rev[100201];
vector<int> a1[100201];
vector<char> a2[100201];
int dx[4] = {0, -1, 0, 1};
int dy[4] = {-1, 0, 1, 0};
char dir[4] = {'L', 'U', 'R', 'D'};
void solve() {
  scanf("%d%d", &n, &m);
  h = 0;
  for (int i = 1; i <= n; i++) {
    a1[i].clear();
    a2[i].clear();
    a[i].clear();
    b[i].clear();
    id[i].clear();
    for (int j = 1; j <= m; j++) {
      int d;
      scanf("%d", &d);
      a[i].push_back(d);
      b[i].push_back(0);
      a1[i].push_back(0);
      a2[i].push_back('A');
      id[i].push_back(++h);
      rev[h] = make_pair(i, j - 1);
    }
  }
  P.init(h + 2);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < m; j++) {
      int myid = id[i][j];
      int par = (i + j) % 2;
      for (int k = 0; k <= 3; k++) {
        int cx = i + dx[k];
        int cy = j + dy[k];
        if (cx >= 1 && cx <= n && cy >= 0 && cy < m) {
          int nid = id[cx][cy];
          if (a[cx][cy] == a[i][j]) {
            if (par) {
              P.insert(myid, nid, 0, 1);
            } else {
            }
          }
          if (a[cx][cy] < a[i][j]) {
            b[i][j] = 1;
            a1[i][j] = a[i][j] - a[cx][cy];
            a2[i][j] = dir[k];
          }
        }
      }
      if (par) {
        P.insert(h + 1, myid, 1 - b[i][j], 1);
      } else {
        P.insert(myid, h + 2, 1 - b[i][j], 1);
      }
    }
  int good = P.MaxFlow(h + 1, h + 2);
  if (good == -1) {
    puts("NO");
    return;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < m; j++) {
      int myid = id[i][j];
      int par = (i + j) % 2;
      if (par) {
        for (auto e : P.A.g[myid])
          if (e.f == 1) {
            int nt = e.to;
            if (nt <= h) {
              int cx = rev[nt].first;
              int cy = rev[nt].second;
              a1[i][j] = 1;
              a1[cx][cy] = a[cx][cy] - 1;
              for (int k = 0; k <= 3; k++) {
                if (i + dx[k] == cx && j + dy[k] == cy) {
                  a2[i][j] = dir[k];
                  a2[cx][cy] = dir[(k + 2) % 4];
                  break;
                }
              }
            }
          }
      }
    }
  puts("YES");
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < m; j++)
      printf("%d%c", a1[i][j], (j == m - 1 ? '\n' : ' '));
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < m; j++)
      printf("%c%c", a2[i][j], (j == m - 1 ? '\n' : ' '));
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
}