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;
using ll = long long;
template <class t, class u>
void chmax(t& first, u second) {
  if (first < second) first = second;
}
template <class t, class u>
void chmin(t& first, u second) {
  if (second < first) first = second;
}
template <class t>
using vc = vector<t>;
template <class t>
using vvc = vc<vc<t>>;
using pi = pair<ll, ll>;
using vi = vc<ll>;
template <class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
  return os << "{" << p.first << "," << p.second << "}";
}
template <class t>
ostream& operator<<(ostream& os, const vc<t>& v) {
  os << "{";
  for (auto e : v) os << e << ",";
  return os << "}";
}
using uint = unsigned;
using ull = unsigned long long;
template <class t, size_t n>
ostream& operator<<(ostream& os, const array<t, n>& first) {
  return os << vc<t>(first.begin(), first.end());
}
template <ll i, class T>
void print_tuple(ostream&, const T&) {}
template <ll i, class T, class H, class... Args>
void print_tuple(ostream& os, const T& t) {
  if (i) os << ",";
  os << get<i>(t);
  print_tuple<i + 1, T, Args...>(os, t);
}
template <class... Args>
ostream& operator<<(ostream& os, const tuple<Args...>& t) {
  os << "{";
  print_tuple<0, tuple<Args...>, Args...>(os, t);
  return os << "}";
}
template <class t>
void print(t x, ll suc = 1) {
  cout << x;
  if (suc == 1) cout << "\n";
  if (suc == 2) cout << " ";
}
ll read() {
  ll i;
  cin >> i;
  return i;
}
vi readvi(ll n, ll off = 0) {
  vi v(n);
  for (ll i = ll(0); i < ll(n); i++) v[i] = read() + off;
  return v;
}
pi readpi(ll off = 0) {
  ll first, second;
  cin >> first >> second;
  return pi(first + off, second + off);
}
template <class T>
void print(const vector<T>& v, ll suc = 1) {
  for (ll i = ll(0); i < ll(v.size()); i++)
    print(v[i], i == ll(v.size()) - 1 ? suc : 2);
}
string readString() {
  string s;
  cin >> s;
  return s;
}
template <class T>
T sq(const T& t) {
  return t * t;
}
void yes(bool ex = true) {
  cout << "YES"
       << "\n";
  if (ex) exit(0);
}
void no(bool ex = true) {
  cout << "NO"
       << "\n";
  if (ex) exit(0);
}
void possible(bool ex = true) {
  cout << "POSSIBLE"
       << "\n";
  if (ex) exit(0);
}
void impossible(bool ex = true) {
  cout << "IMPOSSIBLE"
       << "\n";
  if (ex) exit(0);
}
constexpr ll ten(ll n) { return n == 0 ? 1 : ten(n - 1) * 10; }
const ll infLL = LLONG_MAX / 3;
const ll inf = infLL;
ll topbit(signed t) { return t == 0 ? -1 : 31 - __builtin_clz(t); }
ll topbit(ll t) { return t == 0 ? -1 : 63 - __builtin_clzll(t); }
ll botbit(signed first) { return first == 0 ? 32 : __builtin_ctz(first); }
ll botbit(ll first) { return first == 0 ? 64 : __builtin_ctzll(first); }
ll popcount(signed t) { return __builtin_popcount(t); }
ll popcount(ll t) { return __builtin_popcountll(t); }
bool ispow2(ll i) { return i && (i & -i) == i; }
ll mask(ll i) { return (ll(1) << i) - 1; }
bool inc(ll first, ll second, ll c) { return first <= second && second <= c; }
template <class t>
void mkuni(vc<t>& v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
ll rand_int(ll l, ll r) {
  static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
  return uniform_int_distribution<ll>(l, r)(gen);
}
template <class t>
void myshuffle(vc<t>& first) {
  for (ll i = ll(0); i < ll(ll(first.size())); i++)
    swap(first[i], first[rand_int(0, i)]);
}
template <class t>
ll lwb(const vc<t>& v, const t& first) {
  return lower_bound(v.begin(), v.end(), first) - v.begin();
}
vvc<ll> readGraph(ll n, ll m) {
  vvc<ll> g(n);
  for (ll i = ll(0); i < ll(m); i++) {
    ll first, second;
    cin >> first >> second;
    first--;
    second--;
    g[first].push_back(second);
    g[second].push_back(first);
  }
  return g;
}
vvc<ll> readTree(ll n) { return readGraph(n, n - 1); }
template <class d>
struct maxflow {
  struct E {
    ll to, rev;
    d cap;
  };
  vvc<E> g;
  vi itr, lv, q;
  maxflow(ll n) : g(n), itr(n), lv(n), q(n) {}
  pi ae(ll s, ll t, d c) {
    g[s].push_back({t, (ll)g[t].size(), c});
    g[t].push_back({s, (ll)g[s].size() - 1, 0});
    return pi(s, ll(g[s].size()) - 1);
  }
  void bfs(ll s) {
    fill(lv.begin(), lv.end(), -1);
    lv[s] = 0;
    ll l = 0, r = 0;
    q[r++] = s;
    while (l < r) {
      ll v = q[l++];
      for (auto e : g[v])
        if (e.cap > 0 && lv[e.to] == -1) {
          lv[e.to] = lv[v] + 1;
          q[r++] = e.to;
        }
    }
  }
  d dfs(ll v, ll t, d f) {
    if (v == t) return f;
    d res = 0;
    for (ll& i = itr[v]; i < (ll)g[v].size(); i++) {
      E& e = g[v][i];
      if (e.cap > 0 && lv[e.to] == lv[v] + 1) {
        d first = dfs(e.to, t, min(f, e.cap));
        if (first > 0) {
          e.cap -= first;
          g[e.to][e.rev].cap += first;
          res += first;
          f -= first;
          if (f <= 0) break;
        }
      }
    }
    return res;
  }
  d calc(ll s, ll t, d mx = inf) {
    d f = 0;
    while (f < mx) {
      bfs(s);
      if (lv[t] == -1) return f;
      fill(itr.begin(), itr.end(), 0);
      f += dfs(s, t, mx - f);
    }
    return f;
  }
};
void slv() {
  ll n, m;
  cin >> n >> m;
  vvc<ll> first(n, vi(m));
  for (ll i = ll(0); i < ll(n); i++) first[i] = readvi(m);
  if (n * m == 1) {
    no(0);
    return;
  }
  {
    for (ll i = ll(0); i < ll(n); i++)
      for (ll j = ll(0); j < ll(m); j++) {
        if (first[i][j] == 1) {
          no(0);
          return;
        }
      }
  }
  vvc<ll> idx(n, vi(m, -1));
  ll cnt[2]{};
  for (ll i = ll(0); i < ll(n); i++)
    for (ll j = ll(0); j < ll(m); j++) {
      ll p = (i + j) % 2;
      idx[i][j] = cnt[p]++;
    }
  ll s = cnt[0] + cnt[1];
  maxflow<ll> mf(s + 4);
  vc<tuple<pi, pi, pi>> match;
  vc<string> ans(n, string(m, '?'));
  const ll dyx[]{-1, 0, 1, 0, -1};
  const string dirstr = "URDL";
  vvc<ll> vals(n, vi(m, -1));
  for (ll i = ll(0); i < ll(n); i++)
    for (ll j = ll(0); j < ll(m); j++) {
      for (ll dir = ll(0); dir < ll(4); dir++) {
        ll y = i + dyx[dir];
        ll x = j + dyx[dir + 1];
        if (inc(0, y, n - 1) && inc(0, x, m - 1)) {
          if (first[y][x] < first[i][j]) {
            ans[i][j] = dirstr[dir];
            vals[i][j] = first[i][j] - first[y][x];
          }
        }
      }
      ll p = (i + j) % 2;
      ll k = idx[i][j];
      if (ans[i][j] == '?') {
        if (p == 0) {
          mf.ae(s + 1, k, 1);
        } else {
          mf.ae(cnt[0] + k, s + 3, 1);
        }
      } else {
        if (p == 0) {
          mf.ae(s, k, 1);
        } else {
          mf.ae(cnt[0] + k, s + 2, 1);
        }
      }
      if (p == 0) {
        for (ll dir = ll(0); dir < ll(4); dir++) {
          ll y = i + dyx[dir];
          ll x = j + dyx[dir + 1];
          if (inc(0, y, n - 1) && inc(0, x, m - 1) &&
              first[i][j] == first[y][x]) {
            match.emplace_back(pi(i, j), pi(y, x),
                               mf.ae(k, cnt[0] + idx[y][x], 1));
          }
        }
      }
    }
  mf.calc(s + 1, s + 3);
  mf.calc(s + 1, s + 2);
  mf.calc(s + 0, s + 3);
  mf.calc(s + 0, s + 2);
  for (auto z : match) {
    pi fr, to, e;
    tie(fr, to, e) = z;
    if (mf.g[e.first][e.second].cap == 0) {
      for (ll dir = ll(0); dir < ll(4); dir++) {
        ll y = fr.first + dyx[dir];
        ll x = fr.second + dyx[dir + 1];
        if (pi(y, x) == to) {
          ans[fr.first][fr.second] = dirstr[dir];
          ans[to.first][to.second] = dirstr[dir ^ 2];
          vals[fr.first][fr.second] = 1;
          vals[to.first][to.second] = first[to.first][to.second] - 1;
        }
      }
    }
  }
  for (ll i = ll(0); i < ll(n); i++)
    for (ll j = ll(0); j < ll(m); j++)
      if (ans[i][j] == '?') {
        no(0);
        return;
      }
  yes(0);
  for (ll i = ll(0); i < ll(n); i++) print(vals[i]);
  for (ll i = ll(0); i < ll(n); i++)
    print(vc<char>(ans[i].begin(), ans[i].end()));
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  ll t;
  cin >> t;
  for (ll _ = ll(0); _ < ll(t); _++) slv();
}