It is only a few days until Seollal (Korean Lunar New Year), and Jaehyun has invited his family to his garden. There are kids among the guests. To make the gathering more fun for the kids, Jaehyun is going to run a game of hide-and-seek.

The garden can be represented by a n × m grid of unit cells. Some (possibly zero) cells are blocked by rocks, and the remaining cells are free. Two cells are neighbors if they share an edge. Each cell has up to 4 neighbors: two in the horizontal direction and two in the vertical direction. 

Since the garden is represented as a grid, we can classify the cells in the garden as either "black" or "white". The top-left cell is black, and two cells which are neighbors must be different colors. Cell indices are 1-based, so the top-left corner of the garden is cell (1, 1).

Jaehyun wants to turn his garden into a maze by placing some walls between two cells. Walls can only be placed between neighboring cells. If the wall is placed between two neighboring cells a and b, then the two cells a and b are not neighboring from that point. One can walk directly between two neighboring cells if and only if there is no wall directly between them. 

A maze must have the following property. For each pair of free cells in the maze, there must be exactly one simple path between them. A simple path between cells a and b is a sequence of free cells in which the first cell is a, the last cell is b, all cells are distinct, and any two consecutive cells are neighbors which are not directly blocked by a wall.

At first, kids will gather in cell (1, 1), and start the hide-and-seek game. A kid can hide in a cell if and only if that cell is free, it is not (1, 1), and has exactly one free neighbor. Jaehyun planted roses in the black cells, so it's dangerous if the kids hide there. So Jaehyun wants to create a maze where the kids can only hide in white cells.

You are given the map of the garden as input. Your task is to help Jaehyun create a maze.

Input

Your program will be judged in multiple test cases.

The first line contains the number of test cases t. (1 ≤ t ≤ 100). Afterward, t test cases with the described format will be given.

The first line of a test contains two integers n, m (2 ≤ n, m ≤ 20), the size of the grid.

In the next n line of a test contains a string of length m, consisting of the following characters (without any whitespace): 

  * O: A free cell. 
  * X: A rock. 



It is guaranteed that the first cell (cell (1, 1)) is free, and every free cell is reachable from (1, 1). 

If t ≥ 2 is satisfied, then the size of the grid will satisfy n ≤ 10, m ≤ 10. In other words, if any grid with size n > 10 or m > 10 is given as an input, then it will be the only input on the test case (t = 1).

Output

For each test case, print the following:

If there are no possible mazes, print a single line NO.

Otherwise, print a single line YES, followed by a grid of size (2n-1) × (2m-1) denoting the found maze. The rules for displaying the maze follows. All cells are indexed in 1-base.

  * For all 1 ≤ i ≤ n, 1 ≤ j ≤ m, if the cell (i, j) is free cell, print 'O' in the cell (2i-1, 2j-1). Otherwise, print 'X' in the cell (2i-1, 2j-1). 
  * For all 1 ≤ i ≤ n, 1 ≤ j ≤ m-1, if the neighboring cell (i, j), (i, j+1) have wall blocking it, print ' ' in the cell (2i-1, 2j). Otherwise, print any printable character except spaces in the cell (2i-1, 2j). A printable character has an ASCII code in range [32, 126]: This includes spaces and alphanumeric characters. 
  * For all 1 ≤ i ≤ n-1, 1 ≤ j ≤ m, if the neighboring cell (i, j), (i+1, j) have wall blocking it, print ' ' in the cell (2i, 2j-1). Otherwise, print any printable character except spaces in the cell (2i, 2j-1) 
  * For all 1 ≤ i ≤ n-1, 1 ≤ j ≤ m-1, print any printable character in the cell (2i, 2j). 



Please, be careful about trailing newline characters or spaces. Each row of the grid should contain exactly 2m-1 characters, and rows should be separated by a newline character. Trailing spaces must not be omitted in a row.

Example

Input


4
2 2
OO
OO
3 3
OOO
XOO
OOO
4 4
OOOX
XOOX
OOXO
OOOO
5 6
OOOOOO
OOOOOO
OOOOOO
OOOOOO
OOOOOO


Output


YES
OOO
  O
OOO
NO
YES
OOOOO X
  O O  
X O O X
  O    
OOO X O
O O   O
O OOOOO
YES
OOOOOOOOOOO
  O   O   O
OOO OOO OOO
O   O   O  
OOO OOO OOO
  O   O   O
OOO OOO OOO
O   O   O  
OOO OOO OOO
#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool get_int(T &x) {
  char t = getchar();
  bool neg = false;
  x = 0;
  for (; (t > '9' || t < '0') && t != '-' && t != EOF; t = getchar())
    ;
  if (t == '-') neg = true, t = getchar();
  if (t == EOF) return false;
  for (; t <= '9' && t >= '0'; t = getchar()) x = x * 10 + t - '0';
  if (neg) x = -x;
  return true;
}
template <typename T>
void print_int(T x) {
  if (x < 0) putchar('-'), x = -x;
  short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
const int inf = 0x3f3f3f3f;
const long long Linf = 1ll << 61;
const double pi = acos(-1.0);
const int maxn = 888;
template <typename Mat1, typename Mat2>
vector<int> Matroid_Intersection(Mat1 &M1, Mat2 &M2) {
  static bool choose[maxn], X1[maxn], X2[maxn], vis[maxn];
  static int pre[maxn];
  static vector<int> g[maxn];
  if (!M1.check(vector<int>()) || !M2.check(vector<int>()))
    return vector<int>();
  assert(M1.size() == M2.size());
  int SZ = M1.size();
  memset(choose, 0, sizeof(choose[0]) * (SZ + 10));
  vector<int> I;
  for (int i = 1; i <= SZ; i++)
    if (M1.test(i) && M2.test(i)) {
      I.push_back(i);
      M1.check(I);
      M2.check(I);
      choose[i] = 1;
    }
  while (true) {
    memset(X1, 0, sizeof(X1[0]) * (SZ + 10));
    memset(X2, 0, sizeof(X2[0]) * (SZ + 10));
    vector<int> I;
    for (int i = 1; i <= SZ; i++)
      if (choose[i]) I.push_back(i);
    assert(M1.check(I));
    assert(M2.check(I));
    bool update = 0;
    for (int i = 1; i <= SZ; i++)
      if (!choose[i]) {
        X1[i] = M1.test(i);
        X2[i] = M2.test(i);
        if (X1[i] && X2[i]) {
          choose[i] = 1;
          update = 1;
          break;
        }
      }
    if (update) continue;
    memset(vis, 0, sizeof(vis[0]) * (SZ + 10));
    for (int i = 1; i <= SZ; i++) g[i].clear();
    for (auto x : I) {
      vector<int> nI;
      for (auto v : I)
        if (v != x) nI.push_back(v);
      M1.check(nI);
      M2.check(nI);
      for (int i = 1; i <= SZ; i++)
        if (!choose[i]) {
          if (M2.test(i)) g[i].push_back(x);
          if (M1.test(i)) g[x].push_back(i);
        }
    }
    queue<int> q;
    for (int i = 1; i <= SZ; i++)
      if (X1[i]) {
        vis[i] = 1;
        pre[i] = 0;
        q.push(i);
      }
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      if (X2[x]) {
        update = 1;
        int cur = x;
        while (cur) {
          choose[cur] ^= 1;
          cur = pre[cur];
        }
        break;
      }
      for (int i = 0; i < (int)g[x].size(); i++)
        if (!vis[g[x][i]]) {
          vis[g[x][i]] = 1;
          q.push(g[x][i]);
          pre[g[x][i]] = x;
        }
    }
    if (!update) return I;
  }
}
struct Color_Matroid {
  int col[maxn], lim[maxn], SZ, n;
  int count[maxn];
  inline int size() { return SZ; }
  inline bool check(const vector<int> &v) {
    memset(count, 0, sizeof(int) * (n + 10));
    for (int i = 0; i < (int)v.size(); i++) {
      assert(1 <= v[i] && v[i] <= SZ);
      int c = col[v[i]];
      count[c]++;
      if (count[c] > lim[c]) return false;
    }
    return true;
  }
  inline bool test(int x) { return count[col[x]] < lim[col[x]]; }
} M1;
struct graphic_matroid {
  int SZ, n, eu[maxn], ev[maxn], f[maxn];
  int size() { return SZ; }
  inline int gf(int x) { return x == f[x] ? x : f[x] = gf(f[x]); }
  bool check(const vector<int> &es) {
    for (int i = 1; i <= n; i++) f[i] = i;
    for (auto i : es) {
      if (gf(eu[i]) == gf(ev[i])) return false;
      f[f[eu[i]]] = f[ev[i]];
    }
    return true;
  }
  bool test(int id) { return gf(eu[id]) != gf(ev[id]); }
} M2;
const int N = 25;
char s[N][N], t[N * 2][N * 2];
int n, m, vtot, etot, id[N][N], eid[N][N][2], dgr[N][N], f[maxn];
int gf(int x) { return x == f[x] ? x : f[x] = gf(f[x]); }
bool choose[maxn];
void solve() {
  memset(s, 0, sizeof(s));
  (get_int(n) && get_int(m));
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  memset(id, 0, sizeof(id));
  memset(eid, 0, sizeof(eid));
  memset(dgr, 0, sizeof(dgr));
  memset(M1.lim, 0, sizeof(M1.lim));
  vtot = etot = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (s[i][j] == 'O') id[i][j] = ++vtot;
  M1.n = M2.n = vtot;
  int sum = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (s[i][j] == 'O' && (i > 1 || j > 1)) {
        if ((i + j) % 2 == 0) {
          sum += 2;
          M1.lim[id[i][j]] = 2;
        }
        if (s[i][j + 1] == 'O') {
          eid[i][j][0] = ++etot;
          M2.eu[etot] = id[i][j];
          M2.ev[etot] = id[i][j + 1];
          if ((i + j) % 2 == 0)
            M1.col[etot] = id[i][j];
          else
            M1.col[etot] = id[i][j + 1];
          dgr[i][j]++;
          dgr[i][j + 1]++;
        }
        if (s[i + 1][j] == 'O') {
          eid[i][j][1] = ++etot;
          M2.eu[etot] = id[i][j];
          M2.ev[etot] = id[i + 1][j];
          if ((i + j) % 2 == 0)
            M1.col[etot] = id[i][j];
          else
            M1.col[etot] = id[i + 1][j];
          dgr[i][j]++;
          dgr[i + 1][j]++;
        }
      }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (s[i][j] == 'O' && (i > 1 || j > 1) && (i + j) % 2 == 0 &&
          dgr[i][j] < 2) {
        puts("NO");
        return;
      }
  M1.SZ = M2.SZ = etot;
  vector<int> ans = Matroid_Intersection(M1, M2);
  if ((int)ans.size() < sum) {
    puts("NO");
    return;
  }
  puts("YES");
  memset(choose, 0, sizeof(choose));
  for (int i = 1; i <= vtot; i++) f[i] = i;
  for (int i = 0; i < sum; i++) {
    choose[ans[i]] = 1;
    f[gf(M2.eu[ans[i]])] = gf(M2.ev[ans[i]]);
  }
  memset(t, 0, sizeof(t));
  for (int i = 1; i <= n + n - 1; i++)
    for (int j = 1; j <= m + m - 1; j++) t[i][j] = ' ';
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      t[i * 2 - 1][j * 2 - 1] = s[i][j];
      if (s[i][j] == 'X') continue;
      if (choose[eid[i][j][0]])
        t[i * 2 - 1][j * 2] = 'O';
      else if (s[i][j + 1] == 'O' && gf(id[i][j]) != gf(id[i][j + 1])) {
        f[gf(id[i][j])] = gf(id[i][j + 1]);
        t[i * 2 - 1][j * 2] = 'O';
      }
      if (choose[eid[i][j][1]])
        t[i * 2][j * 2 - 1] = 'O';
      else if (s[i + 1][j] == 'O' && gf(id[i][j]) != gf(id[i + 1][j])) {
        f[gf(id[i][j])] = gf(id[i + 1][j]);
        t[i * 2][j * 2 - 1] = 'O';
      }
    }
  for (int i = 1; i <= n + n - 1; i++) printf("%s\n", t[i] + 1);
}
int main() {
  int tc;
  get_int(tc);
  while (tc--) solve();
  return 0;
}
