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 <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T, class U>
void _W(const pair<T, U> &x) {
  _W(x.first);
  putchar(' ');
  _W(x.second);
}
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
int MOD = 1e9 + 7;
void ADD(long long &x, long long v) {
  x = (x + v) % MOD;
  if (x < 0) x += MOD;
}
const int SIZE = 1 << 17;
struct E {
  int k;
  long long c;
  E() {}
  E(int _k, long long _c) : k(_k), c(_c) {}
} es[2000010];
struct Flow {
  int n, m, dis[500010];
  int qq[500010], qr, ql;
  int ptr[500010];
  vector<int> e[500010];
  void init(int _n) {
    n = _n;
    m = 0;
    for (int i = 0; i < n; i++) {
      vector<int> tmp;
      e[i].swap(tmp);
    }
  }
  void add_edge(int a, int b, long long c) {
    e[a].push_back(m);
    es[m] = E(b, c);
    m++;
    e[b].push_back(m);
    es[m] = E(a, 0);
    m++;
  }
  bool BFS() {
    memset(dis, -1, n * sizeof(int));
    ql = qr = 0;
    qq[qr++] = 0;
    dis[0] = 0;
    while (ql != qr && dis[n - 1] == -1) {
      int p = qq[ql++];
      for (auto &it : e[p]) {
        E ee = es[it];
        if (ee.c == 0 || dis[ee.k] != -1) continue;
        dis[ee.k] = dis[p] + 1;
        qq[qr++] = ee.k;
      }
    }
    return dis[n - 1] != -1;
  }
  long long go(int p, long long c) {
    if (p == n - 1) return c;
    long long ret = 0, tmp;
    for (int &i = ptr[p]; i < ((int)(e[p]).size()); i++) {
      auto it = e[p][i];
      E &ee = es[it];
      if (ee.c == 0 || dis[p] + 1 != dis[ee.k]) continue;
      tmp = go(ee.k, min(c - ret, (long long)ee.c));
      ret += tmp;
      ee.c -= tmp;
      es[it ^ 1].c += tmp;
      if (ret == c) break;
    }
    if (ret == 0) dis[p] = -1;
    return ret;
  }
  long long maxflow() {
    long long ret = 0;
    while (BFS()) {
      memset(ptr, 0, n * sizeof(int));
      ret += go(0, 1LL << 60);
    }
    return ret;
  }
} flow;
vector<int> a[SIZE], an[SIZE];
string dir[SIZE];
char s[SIZE];
int n, m;
bool out(int x, int y) { return x < 0 || y < 0 || x >= n || y >= m; }
int get(int x, int y) { return x * m + y + 1; }
vector<int> same_dir[SIZE];
string dir_c = "DRUL";
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int safe_dir[SIZE];
void my_clear() {
  for (int i = 0; i < (n * m); ++i) {
    same_dir[i].clear();
  }
  for (int i = 0; i < (n); ++i) {
    {
      string tmp_s;
      dir[i].swap(tmp_s);
    }
    {
      vector<int> tmp;
      a[i].swap(tmp);
    }
    {
      vector<int> tmp;
      an[i].swap(tmp);
    }
  }
}
void solve() {
  flow.init(n * m + 4);
  int cnt[2] = {};
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (m); ++j) {
      cnt[(i + j) & 1]++;
      if ((i + j) & 1) {
        flow.add_edge(0, get(i, j), 1);
      } else {
        flow.add_edge(get(i, j), n * m + 3, 1);
      }
      for (int k = 0; k < (4); ++k) {
        int nx = i + dx[k];
        int ny = j + dy[k];
        if (out(nx, ny)) {
          continue;
        }
        if (a[nx][ny] < a[i][j]) {
          safe_dir[get(i, j)] = k;
        } else if (a[nx][ny] == a[i][j]) {
          if ((i + j) & 1) {
            flow.add_edge(get(i, j), get(nx, ny), 1);
          }
        }
      }
    }
  int v1 = flow.maxflow();
  if (v1 < cnt[1]) {
    int added_v = cnt[1] - v1;
    for (int i = 0; i < (n); ++i)
      for (int j = 0; j < (m); ++j) {
        if (!((i + j) & 1)) continue;
        if (safe_dir[get(i, j)] != -1) {
          flow.add_edge(get(i, j), n * m + 1, 1);
        }
      }
    flow.add_edge(n * m + 1, n * m + 3, added_v);
    if (flow.maxflow() != added_v) {
      W("NO");
      return;
    }
  }
  if (v1 < cnt[0]) {
    int added_v = cnt[0] - v1;
    for (int i = 0; i < (n); ++i)
      for (int j = 0; j < (m); ++j) {
        if ((i + j) & 1) continue;
        if (safe_dir[get(i, j)] != -1) {
          flow.add_edge(n * m + 2, get(i, j), 1);
        }
      }
    flow.add_edge(0, n * m + 2, added_v);
    if (flow.maxflow() != added_v) {
      W("NO");
      return;
    }
  }
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (m); ++j) {
      int id = get(i, j);
      if ((i + j) & 1) {
        for (int eid : flow.e[id]) {
          if (!es[eid].c && es[eid ^ 1].k) {
            int y = es[eid].k;
            if (y > n * m) {
              dir[i][j] = dir_c[safe_dir[id]];
              an[i][j] =
                  a[i][j] - a[i + dx[safe_dir[id]]][j + dy[safe_dir[id]]];
            } else {
              for (int k = 0; k < (4); ++k) {
                int nx = i + dx[k];
                int ny = j + dy[k];
                if (out(nx, ny)) continue;
                if (y == get(nx, ny)) {
                  dir[i][j] = dir_c[k];
                  an[i][j] = 1;
                }
              }
            }
          }
        }
      } else {
        for (int eid : flow.e[id]) {
          if (es[eid].c && es[eid ^ 1].k != n * m + 3) {
            int y = es[eid].k;
            if (y > n * m) {
              dir[i][j] = dir_c[safe_dir[id]];
              an[i][j] =
                  a[i][j] - a[i + dx[safe_dir[id]]][j + dy[safe_dir[id]]];
            } else {
              for (int k = 0; k < (4); ++k) {
                int nx = i + dx[k];
                int ny = j + dy[k];
                if (out(nx, ny)) continue;
                if (y == get(nx, ny)) {
                  dir[i][j] = dir_c[k];
                  an[i][j] = a[i][j] - 1;
                }
              }
            }
          }
        }
      }
    }
  W("YES");
  for (int i = 0; i < (n); ++i) {
    W(an[i]);
  }
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (m); ++j) {
      printf("%c%c", dir[i][j], " \n"[j == m - 1]);
    }
  }
}
void input() {
  R(n, m);
  for (int i = 0; i < (n * m); ++i) safe_dir[i + 1] = -1;
  for (int i = 0; i < (n); ++i) {
    a[i].resize(m);
    an[i].resize(m);
    dir[i].resize(m);
    for (int j = 0; j < (m); ++j) {
      R(a[i][j]);
    }
  }
}
int main() {
  int ___T;
  scanf("%d", &___T);
  for (int cs = 1; cs <= ___T; cs++) {
    input();
    solve();
    my_clear();
  }
  return 0;
}