Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 20 * 20, E_MAX = 20 * 20 * 4;
int t, n, m, grid[20][20];
char maze[40][40];
vector<int> G[N_MAX];
int N = 0, E = 0, id[N_MAX][N_MAX], inP[E_MAX];
vector<vector<int>> P;
vector<int> bound;
pair<int, int> edge[E_MAX];
bool inF[E_MAX], inS1[E_MAX], inS2[E_MAX], seen[N_MAX];
vector<int> F[N_MAX], D[E_MAX];
int comp[N_MAX], in_class[E_MAX], p[E_MAX], between[N_MAX][N_MAX];
queue<int> q;
void max_ind() {
  for (int e = 0; e < E; e++) inF[e] = false;
  for (int i = 0; i < N; i++) F[i].clear();
  for (int e = 0; e < E; e++) D[e].clear();
  for (int i = 0; i < P.size(); i++) in_class[i] = 0;
  while (true) {
    for (int i = 0; i < N; i++) comp[i] = -1;
    int C = 0;
    for (int i = 0; i < N; i++) {
      if (comp[i] != -1) continue;
      q.push(i);
      comp[i] = C;
      while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v : F[u])
          if (comp[v] == -1) {
            comp[v] = C;
            q.push(v);
          }
      }
      C++;
    }
    for (int e = 0; e < E; e++) {
      inS1[e] = (comp[edge[e].first] != comp[edge[e].second]);
      inS2[e] = (in_class[inP[e]] < bound[inP[e]]);
    }
    int inc = 0;
    while (inc < E && !(inS1[inc] && inS2[inc])) inc++;
    if (inc < E) {
      inF[inc] = true;
      int u = edge[inc].first, v = edge[inc].second;
      F[u].push_back(v);
      F[v].push_back(u);
      if (inP[inc] != -1) in_class[inP[inc]]++;
      continue;
    }
    for (int e = 0; e < E; e++) D[e].clear();
    for (int f = 0; f < E; f++) {
      if (inS1[f] || inF[f]) continue;
      int u = edge[f].first, v = edge[f].second;
      for (int i = 0; i < E; i++) p[i] = -1;
      q.push(u);
      p[u] = u;
      while (p[v] == -1) {
        int x = q.front();
        q.pop();
        for (int y : F[x])
          if (p[y] == -1) {
            p[y] = x;
            q.push(y);
          }
      }
      queue<int>().swap(q);
      int w = v;
      while (p[w] != w) {
        D[id[p[w]][w]].push_back(f);
        w = p[w];
      }
    }
    for (int e = 0; e < E; e++) {
      if (inS2[e] || inF[e]) continue;
      for (int f : P[inP[e]])
        if (inF[f]) D[e].push_back(f);
    }
    for (int e = 0; e < E; e++) {
      if (inS1[e]) {
        q.push(e);
        p[e] = e;
      } else
        p[e] = -1;
    }
    int sol = -1;
    while (!q.empty() && sol == -1) {
      int e = q.front();
      q.pop();
      for (int f : D[e]) {
        if (p[f] != -1) continue;
        p[f] = e;
        q.push(f);
        if (inS2[f]) {
          sol = f;
          break;
        }
      }
    }
    queue<int>().swap(q);
    if (sol == -1) return;
    bool add = true;
    int e = sol;
    while (p[e] != e) {
      inF[e] = add;
      in_class[inP[e]] += (add ? 1 : -1);
      add = !add;
      e = p[e];
    }
    inF[e] = true;
    in_class[inP[e]]++;
    for (int i = 0; i < N; i++) F[i].clear();
    for (int e = 0; e < E; e++) {
      if (!inF[e]) continue;
      int u = edge[e].first, v = edge[e].second;
      F[u].push_back(v);
      F[v].push_back(u);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    N = 0;
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      for (int j = 0; j < m; j++) {
        if (s[j] == 'X')
          grid[i][j] = -1;
        else
          grid[i][j] = N++;
      }
    }
    E = 0;
    for (int i = 0; i < N; i++) {
      G[i].clear();
      for (int j = 0; j < N; j++) id[i][j] = -1;
    }
    P.clear();
    bound.clear();
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (grid[i][j] == -1) continue;
        int u = grid[i][j];
        if (i < n - 1 && grid[i + 1][j] != -1) {
          int v = grid[i + 1][j];
          id[u][v] = id[v][u] = E;
          edge[E++] = {u, v};
          G[u].push_back(v);
          G[v].push_back(u);
        }
        if (j < m - 1 && grid[i][j + 1] != -1) {
          int v = grid[i][j + 1];
          id[u][v] = id[v][u] = E;
          edge[E++] = {u, v};
          G[u].push_back(v);
          G[v].push_back(u);
        }
        if ((i + j) % 2 == 0 && i + j != 0) {
          P.push_back(vector<int>());
          if (0 < i && grid[i - 1][j] != -1)
            P.back().push_back(id[u][grid[i - 1][j]]);
          if (0 < j && grid[i][j - 1] != -1)
            P.back().push_back(id[u][grid[i][j - 1]]);
          if (i < n - 1 && grid[i + 1][j] != -1)
            P.back().push_back(id[u][grid[i + 1][j]]);
          if (j < m - 1 && grid[i][j + 1] != -1)
            P.back().push_back(id[u][grid[i][j + 1]]);
          bound.push_back(2);
        }
      }
    }
    for (int e = 0; e < E; e++) inP[e] = -1;
    for (int i = 0; i < P.size(); i++)
      for (int e : P[i]) inP[e] = i;
    P.push_back(vector<int>());
    bound.push_back(0);
    for (int e = 0; e < E; e++) {
      if (inP[e] == -1) {
        P.back().push_back(e);
        inP[e] = P.size();
        inP[e]--;
      }
    }
    max_ind();
    int s = 0;
    for (int e = 0; e < E; e++)
      if (inF[e]) s++;
    if (s + 2 != 2 * P.size()) {
      cout << "NO\n";
      continue;
    }
    cout << "YES\n";
    cout.flush();
    for (int i = 0; i < N; i++) comp[i] = -1;
    int C = 0;
    for (int i = 0; i < N; i++) {
      if (comp[i] != -1) continue;
      comp[i] = C;
      q.push(i);
      while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v : F[u]) {
          if (comp[v] != -1) continue;
          comp[v] = C;
          q.push(v);
        }
      }
      C++;
    }
    for (int i = 0; i < C; i++)
      for (int j = 0; j < C; j++) between[i][j] = -1;
    for (int e = 0; e < E; e++) {
      int u = edge[e].first, v = edge[e].second;
      if (!inF[e] && comp[u] != comp[v] && between[comp[u]][comp[v]] == -1)
        between[comp[u]][comp[v]] = between[comp[v]][comp[u]] = e;
    }
    for (int i = 0; i < N; i++) seen[i] = false;
    seen[0] = true;
    q.push(0);
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (int v = 0; v < C; v++) {
        if (between[u][v] != -1 && !seen[v]) {
          inF[between[u][v]] = true;
          q.push(v);
          seen[v] = true;
        }
      }
    }
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++)
        maze[2 * i][2 * j] = (grid[i][j] == -1 ? 'X' : 'O');
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m - 1; j++) {
        int u = grid[i][j], v = grid[i][j + 1];
        maze[2 * i][2 * j + 1] =
            (u != -1 && v != -1 && !inF[id[u][v]] ? ' ' : '*');
      }
    }
    for (int i = 0; i < n - 1; i++) {
      for (int j = 0; j < m; j++) {
        int u = grid[i][j], v = grid[i + 1][j];
        maze[2 * i + 1][2 * j] =
            (u != -1 && v != -1 && !inF[id[u][v]] ? ' ' : '*');
      }
    }
    for (int i = 0; i < n - 1; i++)
      for (int j = 0; j < m - 1; j++) maze[2 * i + 1][2 * j + 1] = '*';
    for (int i = 0; i < 2 * n - 1; i++) {
      for (int j = 0; j < 2 * m - 1; j++) cout << maze[i][j];
      cout << "\n";
    }
  }
  return 0;
}