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 N = 100000, INF = (1 << 30) - 1;
const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
const char ch[4] = {'R', 'L', 'D', 'U'};
int n, m, flag;
bool Out_map(int x, int y) { return x < 1 || x > n || y < 1 || y > m; }
vector<int> a[N + 9];
void into() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    a[i].resize(m + 2);
    for (int j = 1; j <= m; ++j) scanf("%d", &a[i][j]);
  }
}
int st0, td0, st, td, cn;
int df[N + 9], sum;
struct side {
  int y, next, f;
} e[N * 10 + 9];
int lin[N + 9], cs;
void Ins(int x, int y, int f) {
  e[++cs].y = y;
  e[cs].f = f;
  e[cs].next = lin[x];
  lin[x] = cs;
}
void Ins_flow(int x, int y, int f) {
  Ins(x, y, f);
  Ins(y, x, 0);
}
void Get_graph() {
  cs = 1;
  st0 = n * m + 1;
  td0 = n * m + 2;
  st = n * m + 3;
  td = cn = n * m + 4;
  for (int x = 1; x <= n; ++x)
    for (int y = 1; y <= m; ++y) {
      int p = (x - 1) * m + y, c0 = 0, c1 = 0;
      for (int i = 0; i < 4; ++i) {
        int u = x + dx[i], v = y + dy[i];
        if (Out_map(u, v)) continue;
        int q = (u - 1) * m + v;
        if (a[x][y] == a[u][v]) {
          ++c0;
          if (x + y & 1) Ins_flow(p, q, 1);
        }
        if (a[x][y] > a[u][v]) ++c1;
      }
      if (c0 + c1) {
        if (c1)
          x + y & 1 ? Ins_flow(st0, p, 1) : Ins_flow(p, td0, 1);
        else
          x + y & 1 ? (--df[st0], ++df[p]) : (--df[p], ++df[td0]);
      } else {
        flag = 1;
        return;
      }
    }
  Ins_flow(td0, st0, INF);
  for (int i = 1; i <= cn - 2; ++i) {
    if (!df[i]) continue;
    df[i] > 0 ? Ins_flow(st, i, df[i]) : Ins_flow(i, td, -df[i]);
    sum += max(df[i], 0);
  }
}
int dis[N + 9];
queue<int> q;
bool Bfs_dis(int st, int td) {
  for (int i = 1; i <= cn; ++i) dis[i] = 0;
  for (; !q.empty(); q.pop())
    ;
  dis[st] = 1;
  q.push(st);
  for (; !q.empty();) {
    int t = q.front();
    q.pop();
    for (int i = lin[t]; i; i = e[i].next)
      if (e[i].f && !dis[e[i].y]) {
        dis[e[i].y] = dis[t] + 1;
        if (e[i].y == td) return 1;
        q.push(e[i].y);
      }
  }
  return dis[td];
}
int cur[N + 9];
int Dfs_flow(int k, int td, int f) {
  if (k == td || !f) return f;
  int res = 0;
  for (int &i = cur[k]; i; i = e[i].next)
    if (e[i].f && dis[k] + 1 == dis[e[i].y]) {
      int t = Dfs_flow(e[i].y, td, min(f, e[i].f));
      if (!t) dis[e[i].y] = 0;
      f -= t;
      res += t;
      e[i].f -= t;
      e[i ^ 1].f += t;
      if (!f) return res;
    }
  return res;
}
int Max_flow(int st, int td) {
  int res = 0;
  for (; Bfs_dis(st, td); res += Dfs_flow(st, td, INF))
    for (int i = 1; i <= cn; ++i) cur[i] = lin[i];
  return res;
}
int par[N + 9];
void Get_ans() {
  if (flag) return;
  if (Max_flow(st, td) ^ sum) {
    flag = 1;
    return;
  }
  for (int i = 2; i <= cs; i += 2) {
    if (e[i].f) continue;
    int x = e[i].y, y = e[i ^ 1].y;
    if (x > n * m || y > n * m) continue;
    par[x] = y;
    par[y] = x;
  }
}
void work() {
  Get_graph();
  Get_ans();
}
void outo() {
  if (flag) {
    puts("NO");
    return;
  }
  puts("YES");
  for (int x = 1; x <= n; ++x) {
    for (int y = 1; y <= m; ++y) {
      int p = (x - 1) * m + y;
      if (!par[p]) {
        for (int i = 0; i < 4; ++i) {
          int u = x + dx[i], v = y + dy[i];
          if (Out_map(u, v)) continue;
          if (a[x][y] > a[u][v]) {
            printf("%d ", a[x][y] - a[u][v]);
            break;
          }
        }
      } else {
        for (int i = 0; i < 4; ++i) {
          int u = x + dx[i], v = y + dy[i], q = (u - 1) * m + v;
          if (Out_map(u, v)) continue;
          if (par[p] == q) {
            printf("%d ", p < q ? 1 : a[x][y] - 1);
            break;
          }
        }
      }
    }
    puts("");
  }
  for (int x = 1; x <= n; ++x) {
    for (int y = 1; y <= m; ++y) {
      int p = (x - 1) * m + y;
      if (!par[p]) {
        for (int i = 0; i < 4; ++i) {
          int u = x + dx[i], v = y + dy[i];
          if (Out_map(u, v)) continue;
          if (a[x][y] > a[u][v]) {
            printf("%c ", ch[i]);
            break;
          }
        }
      } else {
        for (int i = 0; i < 4; ++i) {
          int u = x + dx[i], v = y + dy[i], q = (u - 1) * m + v;
          if (Out_map(u, v)) continue;
          if (par[p] == q) {
            printf("%c ", ch[i]);
            break;
          }
        }
      }
    }
    puts("");
  }
  for (int i = 1; i <= n; ++i) a[i].clear();
  for (int i = 1; i <= cn; ++i) lin[i] = df[i] = par[i] = 0;
  sum = flag = 0;
}
int main() {
  int T = 1;
  scanf("%d", &T);
  for (; T--;) {
    into();
    work();
    outo();
  }
  return 0;
}