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;
const int MX = 100005;
struct flowGraph {
  struct Edge {
    int to, flow, cap;
    Edge *res;
    Edge(int to, int flow, int cap) : to(to), flow(flow), cap(cap), res(NULL) {}
    void add(int flow) {
      this->flow += flow;
      this->res->flow -= flow;
    }
  };
  int inf = numeric_limits<int>::max(), V;
  vector<vector<Edge *>> adj;
  vector<int> dist, pos;
  flowGraph(int V) : V(V), adj(V), dist(V), pos(V) {}
  void add(int u, int v, int cap) {
    auto *uv = new Edge(v, 0, cap);
    auto *vu = new Edge(u, 0, 0);
    uv->res = vu;
    vu->res = uv;
    adj[u].push_back(uv);
    adj[v].push_back(vu);
  }
  int dfs(int u, int t, int flow) {
    if (u == t) return flow;
    for (int &i = pos[u]; i < adj[u].size(); i++) {
      auto *v = adj[u][i];
      if (v->cap > v->flow && dist[u] + 1 == dist[v->to]) {
        int fv = dfs(v->to, t, min(flow, v->cap - v->flow));
        if (fv) {
          v->add(fv);
          return fv;
        }
      }
    }
    return 0;
  }
  int dinic(int s, int t) {
    int maxFlow = 0;
    dist[t] = 0;
    while (dist[t] != -1) {
      fill(dist.begin(), dist.end(), -1);
      queue<int> Q;
      Q.push(s);
      dist[s] = 0;
      while (!Q.empty()) {
        int u = Q.front();
        Q.pop();
        for (auto *v : adj[u]) {
          if (dist[v->to] == -1 && v->flow != v->cap) {
            dist[v->to] = dist[u] + 1;
            Q.push(v->to);
          }
        }
      }
      if (dist[t] != -1) {
        int f;
        fill(pos.begin(), pos.end(), 0);
        while (f = dfs(s, t, inf)) maxFlow += f;
      }
    }
    return maxFlow;
  }
};
int n, m, in[MX], out[MX];
int mx[] = {1, -1, 0, 0};
int my[] = {0, 0, 1, -1};
char dir[] = {'D', 'U', 'R', 'L'};
vector<vector<int>> a;
flowGraph *g;
inline int num(int i, int j) { return i * m + j; }
void solve() {
  cin >> n >> m;
  a = vector<vector<int>>(n, vector<int>(m));
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (m); j++) cin >> a[i][j];
  int s = n * m, t = s + 1, ss = t + 1, tt = ss + 1, sd = 0;
  g = new flowGraph(tt + 1);
  for (int i = 0; i < (tt); i++) in[i] = out[i] = 0;
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (m); j++) {
      int f = 0;
      for (int l = 0; l < (4); l++) {
        int x = i + mx[l];
        int y = j + my[l];
        if (0 <= x && x < n && 0 <= y && y < m && a[i][j] > a[x][y]) {
          f = 1;
        }
      }
      if (!f) {
        for (int l = 0; l < (4); l++) {
          int x = i + mx[l];
          int y = j + my[l];
          if (0 <= x && x < n && 0 <= y && y < m && a[i][j] == a[x][y]) {
            int u = num(i, j);
            int v = num(x, y);
            if (i % 2 != j % 2) swap(u, v);
            g->add(u, v, 1);
          }
        }
      }
      if (i % 2 == j % 2) {
        if (f)
          g->add(s, num(i, j), 1);
        else
          out[s]++, in[num(i, j)]++;
      } else {
        if (f)
          g->add(num(i, j), t, 1);
        else
          out[num(i, j)]++, in[t]++;
      }
    }
  for (int i = 0; i < (tt); i++) {
    sd += in[i];
    if (in[i]) g->add(ss, i, in[i]);
    if (out[i]) g->add(i, tt, out[i]);
  }
  g->add(t, s, g->inf);
  if (g->dinic(ss, tt) == sd) {
    cout << "YES" << '\n';
    for (int i = 0; i < (n); i++) {
      for (int j = 0; j < (m); j++) {
        int f = 0;
        for (auto *e : g->adj[num(i, j)])
          if (e->to < n * m && e->flow) {
            if (i % 2 == j % 2)
              cout << a[i][j] - 1;
            else
              cout << 1;
            f = 1;
          }
        if (!f)
          for (int l = 0; l < (4); l++) {
            int x = i + mx[l];
            int y = j + my[l];
            if (0 <= x && x < n && 0 <= y && y < m && a[i][j] > a[x][y]) {
              cout << a[i][j] - a[x][y];
              break;
            }
          }
        cout << " ";
      }
      cout << '\n';
    }
    for (int i = 0; i < (n); i++) {
      for (int j = 0; j < (m); j++) {
        int f = 0;
        for (auto *e : g->adj[num(i, j)])
          if (e->to < n * m && e->flow) {
            int u = num(i, j);
            int v = e->to;
            if (u - m == v)
              cout << 'U';
            else if (u + m == v)
              cout << 'D';
            else if (u + 1 == v)
              cout << 'R';
            else
              cout << 'L';
            f = 1;
          }
        if (!f)
          for (int l = 0; l < (4); l++) {
            int x = i + mx[l];
            int y = j + my[l];
            if (0 <= x && x < n && 0 <= y && y < m && a[i][j] > a[x][y]) {
              cout << dir[l];
              break;
            }
          }
        cout << " ";
      }
      cout << '\n';
    }
  } else {
    cout << "NO" << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}