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;
using Element = int;
using State = vector<char>;
template <typename T_M1, typename T_M2>
State MatroidIntersection(T_M1 matroid1, T_M2 matroid2) {
  assert(matroid1.M == matroid2.M);
  const int M = matroid1.M;
  const Element S = M, T = M + 1;
  State I(M);
  while (true) {
    vector<vector<Element>> to(M + 2);
    for (int e = 0; e < M; e++)
      if (!I[e]) {
        vector<Element> c1 = matroid1.circuit(I, e);
        if (c1.empty()) to[e].push_back(T);
        for (Element f : c1) to[e].push_back(f);
        vector<Element> c2 = matroid2.circuit(I, e);
        if (c2.empty()) to[S].push_back(e);
        for (Element f : c2) to[f].push_back(e);
      }
    vector<Element> backtrack(M + 2, -1);
    queue<Element> q;
    q.push(S);
    while (!q.empty()) {
      Element now = q.front();
      q.pop();
      if (now == T) break;
      for (Element nxt : to[now]) {
        if (backtrack[nxt] == -1) backtrack[nxt] = now, q.push(nxt);
      }
    }
    Element e = backtrack[T];
    if (e == -1) break;
    while (e != S) I[e] = !I[e], e = backtrack[e];
  }
  return I;
}
struct GraphMatroid {
  using Vertex = int;
  int M;
  int V;
  vector<vector<pair<Vertex, Element>>> to;
  vector<pair<Vertex, Vertex>> edges;
  GraphMatroid() = default;
  GraphMatroid(int V, vector<pair<Vertex, Vertex>> edges_)
      : M(edges_.size()), V(V), to(V), edges(edges_) {
    for (size_t e = 0; e < edges_.size(); e++) {
      assert(edges_[e].first < V and edges_[e].second < V);
      to[edges_[e].first].emplace_back(edges_[e].second, e);
      to[edges_[e].second].emplace_back(edges_[e].first, e);
    }
  }
  vector<Element> circuit(State I, Element e) {
    if (I[e]) return {};
    assert(int(I.size()) == M and e < M);
    vector<Element> backtrack(V, -1);
    Vertex S = edges[e].first, T = edges[e].second;
    queue<Vertex> q;
    q.push(S);
    while (!q.empty()) {
      Vertex now = q.front();
      q.pop();
      for (auto nxt : to[now])
        if (I[nxt.second]) {
          I[nxt.second] = 0;
          backtrack[nxt.first] = nxt.second;
          q.push(nxt.first);
        }
    }
    vector<Element> ret;
    while (backtrack[T] != -1) {
      ret.push_back(backtrack[T]);
      T = edges[backtrack[T]].first + edges[backtrack[T]].second - T;
    }
    return ret;
  }
};
struct PartitionMatroid {
  int M;
  vector<vector<Element>> parts;
  vector<int> belong;
  vector<int> maxi;
  PartitionMatroid() = default;
  PartitionMatroid(int M, const vector<vector<int>> &parts,
                   const vector<int> &maxi)
      : M(M), parts(parts), belong(M, -1), maxi(maxi) {
    for (size_t i = 0; i < parts.size(); i++) {
      for (Element x : parts[i]) belong[x] = i;
    }
    for (Element e = 0; e < M; e++) {
      if (belong[e] == -1) {
        belong[e] = this->parts.size();
        this->parts.emplace_back(vector<int>{e});
        this->maxi.push_back(1);
      }
    }
  }
  vector<Element> circuit(const State &I, Element e) {
    if (I[e]) return {};
    assert(int(I.size()) == M and e < M);
    vector<Element> ret;
    int p = belong[e];
    int cnt = 0;
    for (Element x : parts[p]) cnt += I[x];
    if (cnt == maxi[p]) {
      for (Element x : parts[p])
        if (I[x]) ret.push_back(x);
    }
    return ret;
  }
};
struct SizeAwareUnionFind {
  vector<int> par, cou;
  SizeAwareUnionFind(int N) : par(N), cou(N) {
    for (int i = (0), i_end_ = (N); i < i_end_; i++) par[i] = i, cou[i] = 1;
  }
  int find(int x) { return (par[x] == x) ? x : (par[x] = find(par[x])); }
  void unite(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return;
    if (cou[x] < cou[y]) swap(x, y);
    par[y] = x, cou[x] += cou[y];
  }
  int count(int x) { return cou[find(x)]; }
  bool same(int x, int y) { return find(x) == find(y); }
};
void solve() {
  int N, M;
  cin >> N >> M;
  vector<string> S(N);
  for (int i = (0), i_end_ = (N); i < i_end_; i++) cin >> S[i];
  vector<vector<Element>> to(N * M);
  vector<pair<int, int>> edges;
  for (int i = (0), i_end_ = (N); i < i_end_; i++)
    for (int j = (0), j_end_ = (M); j < j_end_; j++)
      if (S[i][j] == 'O') {
        int u = i * M + j;
        if (j < M - 1 and S[i][j + 1] == 'O') {
          int v = u + 1;
          to[u].push_back(edges.size());
          to[v].push_back(edges.size());
          edges.emplace_back(u, v);
        }
        if (i < N - 1 and S[i + 1][j] == 'O') {
          int v = u + M;
          to[u].push_back(edges.size());
          to[v].push_back(edges.size());
          edges.emplace_back(u, v);
        }
      }
  vector<vector<Element>> grps;
  for (int i = (0), i_end_ = (N); i < i_end_; i++)
    for (int j = (0), j_end_ = (M); j < j_end_; j++)
      if ((i + j) % 2 == 0 and S[i][j] == 'O') {
        if (to[i * M + j].size()) grps.emplace_back(to[i * M + j]);
      }
  vector<int> maxi(grps.size(), 2);
  if (maxi.size()) maxi[0] = 1;
  PartitionMatroid mat1(edges.size(), grps, maxi);
  GraphMatroid mat2(N * M, edges);
  State ret = MatroidIntersection(mat1, mat2);
  if (accumulate(ret.begin(), ret.end(), 0) <
      accumulate(maxi.begin(), maxi.end(), 0)) {
    puts("NO");
    return;
  }
  SizeAwareUnionFind uf(N * M);
  vector<string> T(N * 2 - 1, string(M * 2 - 1, ' '));
  for (int i = (0), i_end_ = (N); i < i_end_; i++)
    for (int j = (0), j_end_ = (M); j < j_end_; j++) T[i * 2][j * 2] = S[i][j];
  for (int i = (0), i_end_ = (edges.size()); i < i_end_; i++)
    if (ret[i]) {
      int u = edges[i].first, v = edges[i].second;
      uf.unite(u, v);
      int h = u / M, w = u % M;
      T[h * 2 + (v == u + M)][w * 2 + (v == u + 1)] = 'O';
    }
  for (int i = (0), i_end_ = (edges.size()); i < i_end_; i++)
    if (!ret[i]) {
      int u = edges[i].first, v = edges[i].second;
      if (uf.same(u, v)) continue;
      uf.unite(u, v);
      int h = u / M, w = u % M;
      T[h * 2 + (v == u + M)][w * 2 + (v == u + 1)] = 'O';
    }
  puts("YES");
  for (auto s : T) printf("%s\n", s.c_str());
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) solve();
}