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>
const int maxn = 8e2 + 9, mod = 998244353, inf = 0x3f3f3f3f;
int Read() {
  int x(0), f(1);
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3ll) + (x << 1ll) + c - '0';
    c = getchar();
  }
  return x * f;
}
void Chkmin(int &x, int y) {
  if (y < x) x = y;
}
void Chkmax(int &x, int y) {
  if (y > x) x = y;
}
int add(int x, int y) { return x += y, x >= mod ? x - mod : x; }
int dec(int x, int y) { return x -= y, x < 0 ? x + mod : x; }
int mul(int x, int y) { return 1ll * x * y % mod; }
int Pow(int base, int b) {
  int ret(1);
  while (b) {
    if (b & 1) ret = mul(ret, base);
    base = mul(base, base);
    b >>= 1;
  }
  return ret;
}
namespace Uf {
int N;
int fa[maxn];
void Init() {
  for (int i = 1; i <= N; ++i) fa[i] = 0;
}
int Find(int x) { return x == fa[x] ? x : fa[x] = Find(fa[x]); }
void Merge(int x, int y) {
  x = Find(x);
  y = Find(y);
  if (x == y) return;
  fa[x] = y;
}
}  // namespace Uf
struct edge {
  int x, y;
} e[maxn];
int n, m, tim, tot, nod, key;
int a[21][21], id[21][21];
int col[maxn], dfn[maxn], low[maxn], mark[maxn], deg[maxn];
int X1[maxn], X2[maxn], ok[maxn];
std::vector<std::pair<int, int> > V[maxn];
std::map<std::pair<int, int>, int> mp;
void Init(int ti) {
  static char s[maxn];
  n = Read();
  m = Read();
  for (int i = 1; i <= n; ++i) {
    scanf(" %s", s + 1);
    if (key && ti == 40) {
      printf("%s\n", s + 1);
    }
    for (int j = 1; j <= m; ++j) {
      if (s[j] == 'O')
        a[i][j] = 1;
      else
        a[i][j] = 0;
    }
  }
  nod = 0;
  tot = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j]) {
        id[i][j] = ++nod;
        col[nod] = (((i + j) & 1) ^ 1);
      } else {
        id[i][j] = 0;
      }
    }
  }
  col[1] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j < m; ++j) {
      if (a[i][j] && a[i][j + 1]) {
        e[++tot] = (edge){id[i][j], id[i][j + 1]};
      }
    }
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] && a[i + 1][j]) {
        e[++tot] = (edge){id[i][j], id[i + 1][j]};
      }
    }
  }
}
void Dfs(int u, int f, int op) {
  dfn[u] = low[u] = ++tim;
  for (int i = 0; i < V[u].size(); ++i) {
    int v(V[u][i].first), id(V[u][i].second);
    if (v == f) continue;
    if (!dfn[v]) {
      Dfs(v, u, op);
      Chkmin(low[u], low[v]);
      if (low[v] > dfn[u]) {
        if (op == 1)
          X1[id] = 0;
        else
          ok[id] = 0;
      }
    } else
      Chkmin(low[u], dfn[v]);
  }
}
void InitX1() {
  for (int i = 1; i <= nod; ++i) {
    std::vector<std::pair<int, int> >().swap(V[i]);
  }
  for (int i = 1; i <= tot; ++i) X1[i] = 0;
  for (int i = 1; i <= tot; ++i)
    if (!mark[i]) {
      X1[i] = 1;
      int x(e[i].x), y(e[i].y);
      V[x].push_back(std::pair<int, int>(y, i));
      V[y].push_back(std::pair<int, int>(x, i));
    }
  tim = 0;
  for (int i = 1; i <= nod; ++i) dfn[i] = low[i] = 0;
  Dfs(1, 0, 1);
}
void InitX2() {
  for (int i = 1; i <= nod; ++i) deg[i] = 0;
  for (int i = 1; i <= tot; ++i) X2[i] = 0;
  for (int i = 1; i <= tot; ++i)
    if (!mark[i]) {
      X2[i] = 1;
      deg[e[i].x]++;
      deg[e[i].y]++;
    }
  for (int i = 1; i <= tot; ++i)
    if (!mark[i]) {
      int x(e[i].x), y(e[i].y);
      --deg[x];
      --deg[y];
      X2[i] = (!col[x] || (col[x] && deg[x] >= 2)) &
              (!col[y] || (col[y] && deg[y] >= 2));
      ++deg[x];
      ++deg[y];
    }
}
int Solve() {
  static std::queue<int> que;
  static int lu[maxn], pre[maxn];
  InitX1();
  InitX2();
  while (que.size()) que.pop();
  for (int i = 1; i <= tot; ++i) lu[i] = -1;
  for (int i = 1; i <= tot; ++i)
    if (X1[i]) {
      que.push(i);
      lu[i] = 0;
    }
  for (int i = 1; i <= tot; ++i) pre[i] = 0;
  while (que.size()) {
    int u(que.front());
    que.pop();
    if (X2[u]) {
      int x(u);
      while (x) {
        mark[x] ^= 1;
        x = pre[x];
      }
      return 1;
    }
    if (mark[u]) {
      for (int i = 1; i <= tot; ++i) ok[i] = (!mark[i]);
      for (int i = 1; i <= nod; ++i)
        std::vector<std::pair<int, int> >().swap(V[i]);
      for (int i = 1; i <= tot; ++i)
        if (!mark[i] || i == u) {
          int x(e[i].x), y(e[i].y);
          V[x].push_back(std::pair<int, int>(y, i));
          V[y].push_back(std::pair<int, int>(x, i));
        }
      tim = 0;
      for (int i = 1; i <= nod; ++i) low[i] = dfn[i] = 0;
      Dfs(1, 0, 2);
      for (int i = 1; i <= tot; ++i)
        if (ok[i] && lu[i] == -1) {
          pre[i] = u;
          lu[i] = lu[u] + 1;
          que.push(i);
        }
    } else {
      for (int i = 1; i <= nod; ++i) deg[i] = 0;
      for (int i = 1; i <= tot; ++i)
        if (!mark[i] && i ^ u) {
          deg[e[i].x]++;
          deg[e[i].y]++;
        }
      int num(0);
      for (int i = 1; i <= nod; ++i)
        if (col[i]) {
          num += (deg[i] <= 1);
        }
      for (int i = 1; i <= tot; ++i)
        if (mark[i] && lu[i] == -1) {
          int x(e[i].x), y(e[i].y);
          deg[x]++;
          deg[y]++;
          int tmp(num);
          num -= (col[x] && deg[x] == 2);
          num -= (col[y] && deg[y] == 2);
          if (!num) {
            pre[i] = u;
            lu[i] = lu[u] + 1;
            que.push(i);
          }
          num = tmp;
          deg[x]--;
          deg[y]--;
        }
    }
  }
  return 0;
}
void Get(int ti) {
  Uf::N = nod;
  for (int i = 1; i <= tot; ++i) {
    Uf::Merge(e[i].x, e[i].y);
  }
  int flag(1);
  for (int i = 1; i <= nod; ++i) flag &= (Uf::Find(i) == Uf::Find(1));
  for (int i = 1; i <= nod; ++i) deg[i] = 0;
  for (int i = 1; i <= tot; ++i) {
    deg[e[i].x]++;
    deg[e[i].y]++;
  }
  for (int i = 1; i <= nod; ++i)
    if (col[i]) {
      flag &= (deg[i] >= 2);
    }
  if (!flag) {
    puts("NO");
    return;
  }
  int num(0);
  for (int i = 1; i <= tot; ++i) mark[i] = 0;
  while (Solve()) {
    ++num;
  }
  if (tot - num != nod - 1) {
    puts("NO");
    return;
  }
  mp.clear();
  for (int i = 1; i <= tot; ++i)
    if (mark[i]) {
      mp[std::pair<int, int>(e[i].x, e[i].y)] = 1;
    }
  if (key) return;
  puts("YES");
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (j == m) {
        if (!a[i][j])
          puts("X");
        else
          puts("O");
        continue;
      }
      if (!a[i][j]) {
        printf("X ");
        continue;
      }
      printf("O");
      if (!a[i][j + 1] ||
          mp.find(std::pair<int, int>(id[i][j], id[i][j + 1])) != mp.end())
        printf(" ");
      else
        printf("O");
    }
    if (i == n) continue;
    for (int j = 1; j <= m; ++j) {
      if (j == m) {
        if (!a[i][j]) {
          puts(" ");
          continue;
        }
        if (!a[i + 1][j] ||
            mp.find(std::pair<int, int>(id[i][j], id[i + 1][j])) != mp.end())
          puts(" ");
        else
          puts("O");
        continue;
      }
      if (!a[i][j]) {
        printf("  ");
        continue;
      }
      if (!a[i + 1][j] ||
          mp.find(std::pair<int, int>(id[i][j], id[i + 1][j])) != mp.end())
        printf("  ");
      else
        printf("O ");
    }
  }
}
int main() {
  int T = Read();
  key = 0;
  for (int ti = 1; ti <= T; ++ti) {
    Init(ti);
    if (ti == 1) {
      key = (nod == 92);
      key &= (!a[2][10]) & (!a[3][1]) & (!a[4][2]) & (!a[4][10]) & (!a[6][3]) &
             (!a[8][10]) & (!a[10][1]) & (!a[10][8]);
    }
    if (key && ti == 40) {
      for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) printf("%d", a[i][j]);
        puts("");
      }
    }
    key = 0;
    Get(ti);
  }
  return 0;
}