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;
template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
  bool done_something = false;
  stringstream res;
  res << "[";
  for (; begin_iter != end_iter and counter; ++begin_iter) {
    done_something = true;
    counter--;
    res << *begin_iter << ", ";
  }
  string str = res.str();
  if (done_something) {
    str.pop_back();
    str.pop_back();
  }
  str += "]";
  return str;
}
vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
  vector<int> ord(size);
  for (int i = 0; i < size; i++) ord[i] = i;
  sort(ord.begin(), ord.end(), compare);
  return ord;
}
template <typename T>
bool MinPlace(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool MaxPlace(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T>& p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  for (int i = 0; i < (int)v.size(); i++) {
    out << v[i];
    if (i != (int)v.size() - 1) out << ", ";
  }
  out << "]";
  return out;
}
template <class TH>
void _dbg(const char* name, TH val) {
  clog << name << ": " << val << endl;
}
template <class TH, class... TA>
void _dbg(const char* names, TH curr_val, TA... vals) {
  while (*names != ',') clog << *names++;
  clog << ": " << curr_val << ", ";
  _dbg(names + 1, vals...);
}
struct BiconnectedComponents {
  const int NOT_VISITED = -1;
  int V;
  const vector<int>* aa;
  int current_time;
  vector<int> ot;
  vector<int> low;
  vector<bool> articulation;
  vector<pair<int, int>> bridges;
  BiconnectedComponents(int V, const vector<int> aa[])
      : V(V),
        aa(aa),
        current_time(0),
        ot(V, NOT_VISITED),
        low(V),
        articulation(V, false) {
    for (int v = 0; v < V; v++)
      if (ot[v] == NOT_VISITED) dfs(v, -1);
  }
  void dfs(int v, int father) {
    ot[v] = current_time++;
    low[v] = ot[v];
    int sons = 0;
    for (int a : aa[v]) {
      if (a == father) continue;
      if (ot[a] == NOT_VISITED) {
        dfs(a, v);
        sons++;
        if (low[a] == ot[a]) bridges.push_back({v, a});
        if (father != -1 and low[a] >= ot[v]) articulation[v] = true;
      }
      low[v] = min(low[v], low[a]);
    }
    if (father == -1 and sons >= 2) articulation[v] = true;
  }
};
const int MAXN = 30;
const int MAXE = 2000;
char mat[MAXN][MAXN];
int cell_id[MAXN][MAXN];
char ans[MAXN * 2][MAXN * 2];
int black_adj[MAXE];
int from[MAXE];
int toto[MAXE];
vector<int> edges[MAXE];
int E;
int N, M;
int edge_id[MAXE][MAXE];
int xx[MAXE], yy[MAXE];
int free_cells;
int di[4] = {0, 1, 0, -1};
int dj[4] = {1, 0, -1, 0};
vector<int> aa[MAXE];
int bfs_from[MAXE];
int dd[MAXE];
void bfs(const vector<bool>& sources) {
  for (int i = 0; i < E; i++) dd[i] = 1 << 15, bfs_from[i] = -1;
  queue<int> q;
  for (int i = 0; i < E; i++) {
    if (sources[i]) {
      dd[i] = 0;
      q.push(i);
    }
  }
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int a : aa[v]) {
      if (dd[a] > dd[v] + 1) {
        bfs_from[a] = v;
        dd[a] = dd[v] + 1;
        q.push(a);
      }
    }
  }
}
vector<int> aa_br[MAXE];
vector<bool> find_bridges(const vector<bool>& S) {
  for (int i = 0; i < N * M; i++) aa_br[i].clear();
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) {
      if (mat[i][j] == 'X') continue;
      int id0 = cell_id[i][j];
      for (int t = 0; t < 2; t++) {
        int i1 = i + di[t], j1 = j + dj[t];
        if (i1 < 0 or i1 >= N or j1 < 0 or j1 >= M or mat[i1][j1] == 'X')
          continue;
        int id1 = cell_id[i1][j1];
        if (S[edge_id[id0][id1]]) continue;
        aa_br[id0].push_back(id1);
        aa_br[id1].push_back(id0);
      }
    }
  BiconnectedComponents bc(free_cells, aa_br);
  vector<bool> bridges(E, false);
  for (auto pp : bc.bridges) {
    int a = pp.first, b = pp.second;
    bridges[edge_id[a][b]] = true;
  }
  return bridges;
}
bool augment(vector<bool>& S) {
  vector<bool> nospan1(E, false);
  vector<bool> nospan2 = find_bridges(S);
  for (int i = 0; i < E; i++) nospan2[i] = !nospan2[i] and !S[i];
  for (int i = 0; i < E; i++) {
    if (S[i]) continue;
    int black = black_adj[i];
    if (black == 0)
      nospan1[i] = true;
    else {
      int cnt_adj = 0;
      for (int z : edges[black]) cnt_adj += S[z];
      nospan1[i] = cnt_adj < ((int)((edges[black]).size())) - 2;
    }
  }
  for (int e = 0; e < E; e++)
    if (nospan1[e] and nospan2[e]) {
      S[e] = 1;
      return true;
    }
  for (int i = 0; i < E; i++) aa[i].clear();
  for (int s = 0; s < E; s++)
    for (int t = 0; t < E; t++) {
      if (!S[s] or S[t]) continue;
      if (nospan1[t] or black_adj[s] == black_adj[t]) aa[s].push_back(t);
    }
  for (int s = 0; s < E; s++) {
    if (!S[s]) continue;
    S[s] = 1 ^ S[s];
    vector<bool> new_bridges = find_bridges(S);
    S[s] = 1 ^ S[s];
    for (int t = 0; t < E; t++) {
      if (!S[t] and !new_bridges[t]) aa[t].push_back(s);
    }
  }
  bfs(nospan1);
  int min_dist = 1 << 15;
  for (int i = 0; i < E; i++) {
    if (nospan2[i] and bfs_from[i] != -1) min_dist = min(min_dist, dd[i]);
  }
  if (min_dist >= 1 << 14) return false;
  for (int i = 0; i < E; i++) {
    if (nospan2[i] and dd[i] == min_dist) {
      int it = i;
      while (it != -1) {
        S[it] = S[it] ^ 1;
        it = bfs_from[it];
      }
      break;
    }
  }
  return true;
}
bool visited[MAXN][MAXN];
void easy_visit(int i, int j) {
  visited[i][j] = true;
  for (int t = 0; t < 4; t++) {
    int i1 = i + di[t], j1 = j + dj[t];
    if (i1 < 0 or i1 >= N or j1 < 0 or j1 >= M or mat[i1][j1] == 'X') continue;
    if (!visited[i1][j1]) easy_visit(i1, j1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  for (int t = 0; t < T; t++) {
    cin >> N >> M;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < M; j++) {
        cin >> mat[i][j];
      }
    }
    for (int i = 0; i < N * M; i++) edges[i].clear();
    E = 0;
    free_cells = 0;
    for (int i = 0; i < N; i++)
      for (int j = 0; j < M; j++) cell_id[i][j] = -1;
    for (int i = 0; i < N; i++)
      for (int j = 0; j < M; j++) {
        if (mat[i][j] == 'X') continue;
        if (cell_id[i][j] == -1) {
          cell_id[i][j] = free_cells;
          xx[free_cells] = i, yy[free_cells] = j;
          free_cells++;
        }
        int id0 = cell_id[i][j];
        for (int t = 0; t < 2; t++) {
          int i1 = i + di[t], j1 = j + dj[t];
          if (i1 < 0 or i1 >= N or j1 < 0 or j1 >= M or mat[i1][j1] == 'X')
            continue;
          if (cell_id[i1][j1] == -1) {
            cell_id[i1][j1] = free_cells;
            xx[free_cells] = i1, yy[free_cells] = j1;
            free_cells++;
          }
          int id1 = cell_id[i1][j1];
          from[E] = id0;
          toto[E] = id1;
          edges[id0].push_back(E);
          edges[id1].push_back(E);
          if ((i + j) % 2 == 0)
            black_adj[E] = id0;
          else
            black_adj[E] = id1;
          edge_id[id0][id1] = E;
          edge_id[id1][id0] = E;
          E++;
        }
      }
    bool black_leaf = false;
    for (int i = 0; i < N; i++)
      for (int j = 0; j < M; j++) {
        if ((i == 0 and j == 0) or (i + j) % 2 or mat[i][j] == 'X') continue;
        if (edges[cell_id[i][j]].size() < 2) black_leaf = true;
      }
    if (black_leaf) {
      cout << "NO\n";
      continue;
    }
    for (int i = 0; i < N; i++)
      for (int j = 0; j < M; j++) visited[i][j] = false;
    easy_visit(0, 0);
    bool disconnected = false;
    for (int i = 0; i < N; i++)
      for (int j = 0; j < M; j++) {
        if (mat[i][j] != 'X' and !visited[i][j]) disconnected = true;
      }
    if (disconnected) {
      cout << "NO\n";
      continue;
    }
    vector<bool> S(E, false);
    while (augment(S))
      ;
    int q = 0;
    for (int i = 0; i < E; i++) q += S[i];
    if (E - q != free_cells - 1) {
      cout << "NO\n";
      continue;
    }
    cout << "YES\n";
    for (int i = 0; i < 2 * N - 1; i++)
      for (int j = 0; j < 2 * M - 1; j++) ans[i][j] = ' ';
    for (int i = 0; i < N; i++)
      for (int j = 0; j < M; j++) {
        ans[2 * i][2 * j] = mat[i][j];
        ans[2 * i + 1][2 * j] = '0';
        ans[2 * i][2 * j + 1] = '0';
      }
    for (int i = 0; i < E; i++) {
      if (!S[i]) continue;
      int a = from[i], b = toto[i];
      int x = xx[a];
      int y = yy[a];
      if (x == xx[b]) {
        ans[2 * x][2 * y + 1] = ' ';
      } else {
        ans[2 * x + 1][2 * y] = ' ';
      }
    }
    for (int i = 0; i < 2 * N - 1; i++) {
      for (int j = 0; j < 2 * M - 1; j++) cout << ans[i][j];
      cout << "\n";
    }
  }
}