Problem: There are many sunflowers in the Garden of the Sun.

Garden of the Sun is a rectangular table with n rows and m columns, where the cells of the table are farmlands. All of the cells grow a sunflower on it. Unfortunately, one night, the lightning stroke some (possibly zero) cells, and sunflowers on those cells were burned into ashes. In other words, those cells struck by the lightning became empty. Magically, any two empty cells have no common points (neither edges nor corners).

Now the owner wants to remove some (possibly zero) sunflowers to reach the following two goals: 

  * When you are on an empty cell, you can walk to any other empty cell. In other words, those empty cells are connected. 
  * There is exactly one simple path between any two empty cells. In other words, there is no cycle among the empty cells. 



You can walk from an empty cell to another if they share a common edge.

Could you please give the owner a solution that meets all her requirements?

Note that you are not allowed to plant sunflowers. You don't need to minimize the number of sunflowers you remove. It can be shown that the answer always exists.

Input

The input consists of multiple test cases. The first line contains a single integer t (1≤ t≤ 10^4) — the number of test cases. The description of the test cases follows.

The first line contains two integers n, m (1 ≤ n,m ≤ 500) — the number of rows and columns. 

Each of the next n lines contains m characters. Each character is either 'X' or '.', representing an empty cell and a cell that grows a sunflower, respectively.

It is guaranteed that the sum of n ⋅ m for all test cases does not exceed 250 000.

Output

For each test case, print n lines. Each should contain m characters, representing one row of the table. Each character should be either 'X' or '.', representing an empty cell and a cell with a sunflower, respectively.

If there are multiple answers, you can print any. It can be shown that the answer always exists.

Example

Input


5
3 3
X.X
...
X.X
4 4
....
.X.X
....
.X.X
5 5
.X...
....X
.X...
.....
X.X.X
1 10
....X.X.X.
2 2
..
..


Output


XXX
..X
XXX
XXXX
.X.X
.X..
.XXX
.X...
.XXXX
.X...
.X...
XXXXX
XXXXXXXXXX
..
..

Note

Let's use (x,y) to describe the cell on x-th row and y-th column.

In the following pictures white, yellow, and blue cells stand for the cells that grow a sunflower, the cells lightning stroke, and the cells sunflower on which are removed, respectively.

<image>

In the first test case, one possible solution is to remove sunflowers on (1,2), (2,3) and (3 ,2). 

<image>

Another acceptable solution is to remove sunflowers on (1,2), (2,2) and (3,2). 

<image>

This output is considered wrong because there are 2 simple paths between any pair of cells (there is a cycle). For example, there are 2 simple paths between (1,1) and (3,3).

  1. (1,1)→ (1,2)→ (1,3)→ (2,3)→ (3,3)

  2. (1,1)→ (2,1)→ (3,1)→ (3,2)→ (3,3) 



<image>

This output is considered wrong because you can't walk from (1,1) to (3,3).

Solution (in CPP):

Solution:
#pragma comment(linker, "/STACK:10000000000")
#define forn(from, to, i) for (int i = from; i < to; ++i)
#define fron(from, to, i) for (int i = from; i >= to; --i)
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2")
//#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <stdint.h>
#include <cstdint>
#include <math.h>
#include <cmath>
#include <string>
#include <string.h>
#include <cstring>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <time.h>
#include <deque>
#include <functional>
#include <iomanip>
#include <chrono>
using namespace std;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
#define int long long
#define m_p make_pair
#define all(x) x.begin(), x.end()
#define pii pair <int, int>
#define pb push_back
#define ff first
#define x1 x11337
#define y1 y11337
#define x0 x01337
#define y0 y01337
#define xn xn1337
#define yn yn1337
#define ss second
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define GG return 0
#define vi vector<int> 
#define si set<int>
#define spii set<pair<int, int> >
#define mii map<int, int>
#define vvi vector<vi>
#define vpii vector<pii>
#define qi queue<int>
#define qpii queue<pii>
#define pq priority_queue<int>
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template<typename T> ostream& operator<<(ostream& o, vector<T> x) { for (auto it : x) o << it << ' '; return o; }
template<typename T> istream& operator>>(istream& i, vector<T>& x) { for (auto& it : x) i >> it; return i; }
template <typename T1, typename T2> void chkmin(T1& a, T2 b) { a > b ? a = b : 0; }
template <typename T1, typename T2> void chkmax(T1& a, T2 b) { a < b ? a = b : 0; }
const int INF = 1000000007;
const int INF2 = 100000000000000007;
const int mINF = 1e16;
const int MOD1 = 998244353;
const int MOD = 1000000007;
const int SIZE = 200010;
const int base = 53;
const ldb eps = 1e-6;
const ldb pi = acosl(-1.0);
int add(int a, int b) {
    return ((a + b) % MOD + MOD) % MOD;
}
int mult(int a, int b) {
    return ((a % MOD) * (b % MOD)) % MOD;
}
int binpow(int a, int n) {
    int res = 1;
    while (n) {
        if (n & 1) res = mult(res, a);
        a = mult(a, a);
        n >>= 1;
    }
    return res;
}
int binpow1(int a, int n) {
    int res = 1;
    while (n) {
        if (n & 1) {
            res *= a;
        }
        a *= a;
        n >>= 1;
    }
    return res;
}
int inv(int a) {
    return binpow(a, MOD - 2);
}
int del(int a, int b) {
    return mult(a, inv(b));
}
int gcd(int a, int b) {
    return (b == 0 ? a : gcd(b, a % b));
}
int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}
template <typename T>
T sqr(T x) {
    return x * x;
}
int q, n, m, col, cnt;
char tabl[510][510];
bool ok;
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef _DEBUG   
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    double cl = clock();
#endif
    cin >> q;
    while (q--) {
        cin >> n >> m;
        forn(0, n, i) {
            forn(0, m, j) {
                cin >> tabl[i][j];
            }
        }
        forn(0, n, i) {
            if (i % 3 == 0) fill(tabl[i], tabl[i] + m, 'X');
            else if (i % 3 == 2) {
                ok = 0;
                forn(0, m, j) {
                    if (tabl[i][j] == 'X' || tabl[i - 1][j] == 'X') {
                        tabl[i][j] = tabl[i - 1][j] = 'X';
                        ok = 1;
                        if (i != n - 1) break;
                    }
                }
                if (!ok) tabl[i][0] = tabl[i - 1][0] = 'X';
            }
        }
        forn(0, n, i) {
            forn(0, m, j)cout << tabl[i][j];
            cout << endl;
        }
    }
#ifdef _DEBUG
    cout << "\n\n" << (clock() - cl) / CLOCKS_PER_SEC << " s.\n";
#endif
    GG;
}

//====== READ THIS ======
// 1. Read all the tasks
// 2. Read all the tasks MINDFULLY AGAIN
// 3. Check extreme cases (e.g. N <= 2)
// 4. Check value of SIZE before send an attempt
// 5. Don't sit on a task for a long time if there are no ideas at all
// 6. No tilt, only desire to win
// 7. Remember: #define int long long
//=======================