#include <bits/stdc++.h>
using namespace std;
vector<vector<char>> mat;
long long n, m, li, lj;
string s;
long long di[4] = {0, 0, 1, -1};
long long dj[4] = {1, -1, 0, 0};
bool safe(long long i, long long j) {
  return (i >= 0 and j >= 0 and i < n and j < m and mat[i][j] == '.');
}
void check(long long i, long long j, long long pi, long long pj) {
  while (safe(i, j)) {
    long long posi = -1, posj = -1;
    for (long long k = 0; k < 4; k++) {
      long long i_ = i + di[k], j_ = j + dj[k];
      if (i_ == pi and j_ == pj) continue;
      if (safe(i_, j_)) {
        if (posi == -1) {
          posi = i_;
          posj = j_;
        } else
          return;
      }
    }
    mat[i][j] = '+';
    pi = i, pj = j, i = posi, j = posj;
  }
}
void solve() {
  cin >> n >> m;
  mat = vector<vector<char>>(n, vector<char>(m));
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> mat[i][j];
      if (mat[i][j] == 'L') {
        li = i;
        lj = j;
      }
    }
  }
  for (long long k = 0; k < 4; k++) {
    check(li + di[k], lj + dj[k], li, lj);
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cout << mat[i][j];
    }
    cout << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

There is a grid, consisting of n rows and m columns. Each cell of the grid is either free or blocked. One of the free cells contains a lab. All the cells beyond the borders of the grid are also blocked.

A crazy robot has escaped from this lab. It is currently in some free cell of the grid. You can send one of the following commands to the robot: "move right", "move down", "move left" or "move up". Each command means moving to a neighbouring cell in the corresponding direction.

However, as the robot is crazy, it will do anything except following the command. Upon receiving a command, it will choose a direction such that it differs from the one in command and the cell in that direction is not blocked. If there is such a direction, then it will move to a neighbouring cell in that direction. Otherwise, it will do nothing.

We want to get the robot to the lab to get it fixed. For each free cell, determine if the robot can be forced to reach the lab starting in this cell. That is, after each step of the robot a command can be sent to a robot such that no matter what different directions the robot chooses, it will end up in a lab.

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of testcases.

The first line of each testcase contains two integers n and m (1 ≤ n, m ≤ 10^6; n ⋅ m ≤ 10^6) — the number of rows and the number of columns in the grid.

The i-th of the next n lines provides a description of the i-th row of the grid. It consists of m elements of one of three types: 

  * '.' — the cell is free; 
  * '#' — the cell is blocked; 
  * 'L' — the cell contains a lab. 



The grid contains exactly one lab. The sum of n ⋅ m over all testcases doesn't exceed 10^6.

Output

For each testcase find the free cells that the robot can be forced to reach the lab from. Given the grid, replace the free cells (marked with a dot) with a plus sign ('+') for the cells that the robot can be forced to reach the lab from. Print the resulting grid.

Example

Input


4
3 3
...
.L.
...
4 5
#....
..##L
...#.
.....
1 1
L
1 9
....L..#.


Output


...
.L.
...
#++++
..##L
...#+
...++
L
++++L++#.

Note

In the first testcase there is no free cell that the robot can be forced to reach the lab from. Consider a corner cell. Given any direction, it will move to a neighbouring border grid that's not a corner. Now consider a non-corner free cell. No matter what direction you send to the robot, it can choose a different direction such that it ends up in a corner.

In the last testcase, you can keep sending the command that is opposite to the direction to the lab and the robot will have no choice other than move towards the lab.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
vector<vector<char>> mat;
long long n, m, li, lj;
string s;
long long di[4] = {0, 0, 1, -1};
long long dj[4] = {1, -1, 0, 0};
bool safe(long long i, long long j) {
  return (i >= 0 and j >= 0 and i < n and j < m and mat[i][j] == '.');
}
void check(long long i, long long j, long long pi, long long pj) {
  while (safe(i, j)) {
    long long posi = -1, posj = -1;
    for (long long k = 0; k < 4; k++) {
      long long i_ = i + di[k], j_ = j + dj[k];
      if (i_ == pi and j_ == pj) continue;
      if (safe(i_, j_)) {
        if (posi == -1) {
          posi = i_;
          posj = j_;
        } else
          return;
      }
    }
    mat[i][j] = '+';
    pi = i, pj = j, i = posi, j = posj;
  }
}
void solve() {
  cin >> n >> m;
  mat = vector<vector<char>>(n, vector<char>(m));
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> mat[i][j];
      if (mat[i][j] == 'L') {
        li = i;
        lj = j;
      }
    }
  }
  for (long long k = 0; k < 4; k++) {
    check(li + di[k], lj + dj[k], li, lj);
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cout << mat[i][j];
    }
    cout << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

```