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;
constexpr long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-12;
const long double pi = acosl(-1.0);
long long mod_pow(long long x, long long n, long long m = mod) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
struct modint {
  long long n;
  modint() : n(0) { ; }
  modint(long long m) : n(m) {
    if (n >= mod)
      n %= mod;
    else if (n < 0)
      n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) {
  a.n += b.n;
  if (a.n >= mod) a.n -= mod;
  return a;
}
modint operator-=(modint& a, modint b) {
  a.n -= b.n;
  if (a.n < 0) a.n += mod;
  return a;
}
modint operator*=(modint& a, modint b) {
  a.n = ((long long)a.n * b.n) % mod;
  return a;
}
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, long long n) {
  if (n == 0) return modint(1);
  modint res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
long long inv(long long a, long long p) {
  return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
const int max_n = 1 << 19;
modint fact[max_n], factinv[max_n];
void init_f() {
  fact[0] = modint(1);
  for (int i = 0; i < max_n - 1; i++) {
    fact[i + 1] = fact[i] * modint(i + 1);
  }
  factinv[max_n - 1] = modint(1) / fact[max_n - 1];
  for (int i = max_n - 2; i >= 0; i--) {
    factinv[i] = factinv[i + 1] * modint(i + 1);
  }
}
modint comb(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[b] * factinv[a - b];
}
struct edge {
  int to;
  long long cap;
  int rev;
};
struct Dinic {
 private:
  int n;
  vector<vector<edge>> v;
  vector<int> dist, iter;

 public:
  Dinic(int sz) : n(sz), v(sz), dist(sz), iter(sz) {}
  void addedge(int from, int to, long long cap) {
    int x = v[to].size(), y = v[from].size();
    v[from].push_back({to, cap, x});
    v[to].push_back({from, 0, y});
  }
  void bfs(int s) {
    fill(dist.begin(), dist.end(), -1);
    queue<int> q;
    dist[s] = 0;
    q.push(s);
    while (q.size()) {
      int x = q.front();
      q.pop();
      for (int i = 0; i < v[x].size(); i++) {
        edge& e = v[x][i];
        if (e.cap > 0 && dist[e.to] < 0) {
          dist[e.to] = dist[x] + 1;
          q.push(e.to);
        }
      }
    }
  }
  long long dfs(int x, int t, long long f) {
    if (x == t) return f;
    for (int& i = iter[x]; i < (int)v[x].size(); ++i) {
      edge& e = v[x][i];
      if (e.cap > 0 && dist[x] < dist[e.to]) {
        long long d = dfs(e.to, t, min(f, e.cap));
        if (d > 0) {
          e.cap -= d;
          v[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  long long max_flow(int s, int t) {
    long long flow = 0;
    while (1) {
      bfs(s);
      if (dist[t] < 0) return flow;
      fill(iter.begin(), iter.end(), 0);
      long long f;
      while ((f = dfs(s, t, 1LL << 62)) > 0) flow += f;
    }
  }
  vector<vector<edge>> take() { return v; }
};
int dx[4] = {0, 0, 1, -1};
int dy[4] = {-1, 1, 0, 0};
string dis = "LRDU";
char trans(int i, int j, int x, int y) {
  if (i == x) {
    if (j > y)
      return 'L';
    else
      return 'R';
  } else {
    if (i > x)
      return 'U';
    else
      return 'D';
  }
}
void solve() {
  int h, w;
  cin >> h >> w;
  vector<vector<int>> a(h, vector<int>(w));
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      cin >> a[i][j];
    }
  vector<vector<bool>> b(h, vector<bool>(w, false));
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      for (int d = 0; d < 4; d++) {
        int x = i + dx[d];
        int y = j + dy[d];
        if (x < 0 || y < 0 || x == h || y == w) continue;
        if (a[x][y] < a[i][j]) b[i][j] = true;
      }
    }
  int s = h * w;
  int t = s + 1;
  int xs = t + 1;
  int xt = xs + 1;
  Dinic dc(h * w + 4);
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      int id = (i + j) % 2;
      int cur = i * w + j;
      if (b[i][j]) {
        if (id == 0) {
          dc.addedge(s, cur, 1);
        } else {
          dc.addedge(cur, t, 1);
        }
      } else {
        if (id == 0) {
          dc.addedge(s, xt, 1);
          dc.addedge(xs, cur, 1);
        } else {
          dc.addedge(cur, xt, 1);
          dc.addedge(xs, t, 1);
        }
      }
      if (id == 0) {
        for (int d = 0; d < 4; d++) {
          int x = i + dx[d];
          int y = j + dy[d];
          if (x < 0 || y < 0 || x == h || y == w) continue;
          int to = x * w + y;
          if (a[i][j] == a[x][y]) {
            dc.addedge(cur, to, 1);
          }
        }
      }
    }
  int f = dc.max_flow(xs, xt);
  f += dc.max_flow(s, xt);
  f += dc.max_flow(xs, t);
  f += dc.max_flow(s, t);
  vector<vector<edge>> g = dc.take();
  vector<vector<char>> mp(h, vector<char>(w, '?'));
  vector<vector<int>> ansval(h, vector<int>(w));
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      int id = (i + j) % 2;
      int cur = i * w + j;
      if (!b[i][j]) {
        if (id == 0) {
          for (edge e : g[cur]) {
            if (e.to == xs) {
              if (e.cap == 0) {
                cout << "NO"
                     << "\n";
                return;
              }
            } else {
              if (e.cap == 0) {
                int nx = e.to / w;
                int ny = e.to % w;
                mp[i][j] = trans(i, j, nx, ny);
                mp[nx][ny] = trans(nx, ny, i, j);
                ansval[i][j] = 1;
                ansval[nx][ny] = a[i][j] - 1;
              }
            }
          }
        } else {
          for (edge e : g[cur]) {
            if (e.to == xt) {
              if (e.cap == 1) {
                cout << "NO"
                     << "\n";
                return;
              }
            }
          }
        }
      } else {
        if (id == 0) {
          for (edge e : g[cur]) {
            if (e.to != s) {
              if (e.cap == 0) {
                int nx = e.to / w;
                int ny = e.to % w;
                mp[i][j] = trans(i, j, nx, ny);
                mp[nx][ny] = trans(nx, ny, i, j);
                ansval[i][j] = 1;
                ansval[nx][ny] = a[i][j] - 1;
              }
            }
          }
        }
      }
    }
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      if (mp[i][j] != '?') continue;
      assert(b[i][j]);
      for (int d = 0; d < 4; d++) {
        int x = i + dx[d];
        int y = j + dy[d];
        if (x < 0 || y < 0 || x == h || y == w) continue;
        if (a[i][j] > a[x][y]) {
          mp[i][j] = trans(i, j, x, y);
          ansval[i][j] = a[i][j] - a[x][y];
        }
      }
    }
  cout << "YES\n";
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (j > 0) cout << " ";
      cout << ansval[i][j];
    }
    cout << "\n";
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (j > 0) cout << " ";
      cout << mp[i][j];
    }
    cout << "\n";
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) solve();
  return 0;
}