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 optimization_level 3

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <chrono>
#include <ctime>
#include <queue>
#include <math.h>
#include <deque>
#include <stack>
#include <iomanip>
#include <assert.h>
#include <stdio.h>
#include <cstring>
#include <random>

using namespace std;

#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pld pair<ld, ld>
#define ti tuple<int, int, int>
#define vi vector <int>
#define vpi vector <pii>
#define vld vector <ld>
#define try tr
#define left left11
#define right right11
#define lb lower_bound
#define ub upper_bound
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define pf push_front
#define sqr(a) ((a) * (a))
#define dbg(x) cout << #x << " : " << x << endl;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

clock_t START;

inline ld TIME() {
    return (ld) (clock() - START) / CLOCKS_PER_SEC;
}

void SHOW() {
    cout << fixed << setprecision(10);
    cout << TIME() << " SECONDS FROM START\n";
}

ld TL = 2.0;
int calls = 0;

inline bool IS() {
    if (TL - TIME() < 0.1)
        return true;
    return false;
}

template<typename T1, typename T2>
inline bool amin(T1 &a, T2 b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T1, typename T2>
inline bool amax(T1 &a, T2 b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> &p) {
    os << p.first << ' ' << p.second;
    return os;
}

template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
    is >> p.first >> p.second;
    return is;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (auto &u : v) is >> u;
    return is;
}

template<typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
    for (auto &u : v) os << u << ' ';
    return os;
}

int hash_mod[4] = {1000000007, 998244353, 1000000009, 999999937}, mod = hash_mod[rnd() % 4];
int hash_pows[4] = {179, 239, 1007, 2003}, P = hash_pows[rnd() % 4];

int binpow(int x, int p) {
    int res = 1;
    while (p) {
        if (p % 2)
            res = (res * x) % mod;
        x = (x * x) % mod;
        p /= 2;
    }
    return res;
}

const int N = 1e6 + 7, M = 2e3 + 7, lg = 20, sq = 550, inf = 2e9 + 7;
const ld eps = 1e-9, pi = 3.14159265359;

char a[501][501];

int used[501][501], n, m;

bool check(int x, int y) {
    return a[x][y] != '.' && x >= 0 && x < n && y >= 0 && y < m;
}

int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};

void dfs(int x, int y) {
    used[x][y] = 1;
    for (int it = 0; it < 4; it++) {
        int nx = x + dx[it], ny = y + dy[it];
        if(!check(nx, ny) || used[nx][ny])
            continue;
        dfs(nx, ny);
    }
    used[x][y] = 2;
}

void solve() {
    cin >> n >> m;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
            used[i][j] = 0;
        }
    }

    if(n > 3) {
        for (int i = (n % 3 == 0); i < n; i += 3) {
            for (int j = 0; j < m; j++) {
                a[i][j] = 'X';
            }
            bool f = false;
            for (int j = 0; j < m; j++) {
                if(a[i + 1][j] == 'X') {
                    f = true;
                    a[i + 2][j] = 'X';
                    break;
                }
            }
            if(!f) {
                for (int j = 0; j < m; j++) {
                    if(a[i + 2][j] == 'X') {
                        f = true;
                        a[i + 1][j] = 'X';
                        break;
                    }
                }
            }

            if(!f) {
                a[i + 1][0] = a[i + 2][0] = 'X';
            }
        }
    }
    else {
        for (int j = 0; j < m; j++) {
            a[0][j] = 'X';
            bool f = false;
            for (int i = 1; i < n; i++) {
                if(a[i][j] != '.')
                    f = true;
            }
            if(f) {
                for (int i = 1; i < n; i++) {
                    a[i][j] = 'X';
                }
            }
        }
    }


    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if(a[i][j] == '.')
                cout << '.';
            else
                cout << 'X';
        }
        cout << endl;
    }
    cout << endl;

}

signed main() {
#ifdef _LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast
    int _;
    cin >> _;
    while(_--)
        solve();
}