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:
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define ll         long long
#define D          double
#define P          pair<int,int>
#define Pll        pair<long long,long long>
#define fi         first
#define se         second
//-----------------------------------------math----------------------------------------
#define MAX(x,y)   x=max(x,y)
#define MIN(x,y)   x=min(x,y)
#define pow2(x)    (1<<(x))
//-----------------------------------------STL-------------------------------------------
#define pb         push_back
#define ALL(a)     a.begin(),a.end()
#define POS(a,c)   lower_bound( a.begin() , a.end() , (c) ) - a.begin() + 1
#define UNI(a)     sort(ALL(a)),a.erase(unique(ALL(a)),a.end())
#define DELF(a)    a[0]=a[SZ(a)-1],a.resize(SZ(a)-1)
#define SUM(a,l,r) upper_bound(ALL(a),r)-lower_bound(ALL(a),l)
#define E(a,b)     a.find(b)!=a.end()
//---------------------------------------------io-------------------------------------------
#define read(x)    scanf("%d",&x)
#define FLUSH      fflush(stdout)
#define TC         int T;cin>>T;while(T--)
#define watch(x)   cout<<(#x)<<"  is  "<<x<<endl
#define END        {cout<<-1;return 0;}
//---------------------------------------segment tree---------------------------------------------
#define callmid    int mid=(L+R)>>1
#define ls         p+p
#define rs         p+p+1
#define rmid       r<=mid
#define midl       l>=mid+1
#define xmid       x<=mid
#define lsg        L,mid
#define rsg        mid+1,R
//-----------------------------------------graph---------------------------------------------------
#define read_edge  read(a),read(b),g[a].pb(b),g[b].pb(a)
#define NOT(u)     if(v==u)continue
#define notfa      if(v==fa)continue
//------------------------------------------else---------------------------------------
#define all(a)     a+1,a+n+1
#define SZ(x)      (int)(x).size()
#define mod        998244353
#define modd       1000000007
#define Ceil(a,b)  (a/b+(a%b!=0))
using namespace std;

P operator*(const P&p,const P&x){P np=make_pair(p.fi*x.fi,p.se*x.se);return np;}
Pll operator%(const Pll&p,const Pll&x){Pll np=make_pair(p.fi%x.fi,p.se%x.se);return np;}
Pll operator*(const Pll&p,const P&x){Pll np=make_pair(p.fi*x.fi,p.se*x.se);return np;}
Pll operator*(const Pll&p,const Pll&x){Pll np=make_pair(p.fi*x.fi,p.se*x.se);return np;}
Pll operator+(const Pll&p,const Pll&x){Pll np=make_pair(p.fi+x.fi,p.se+x.se);return np;}
Pll operator-(const Pll&p,const Pll&x){Pll np=make_pair(p.fi-x.fi,p.se-x.se);return np;}
P operator+(const P&p,const P&x){P np=make_pair(p.fi+x.fi,p.se+x.se);return np;}
P operator-(const P&p,const P&x){P np=make_pair(p.fi-x.fi,p.se-x.se);return np;}

vector<int> prime;
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b){return (a.first > b.first);}
bool sortbysecdesc(const pair<int,int> &a,const pair<int,int> &b){return a.second>b.second;}
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b) {return (a.second < b.second);}
ll powerm(ll a, ll k) { if (!k) {return 1;}ll b = powerm(a, k / 2);b = b * b % mod;if (k % 2) {return a * b % mod;} else {return b;}}
ll power(ll a , ll b) { if(b == 1) return a; if(b == 0) return 1; ll m1 = power(a,b/2); if(b%2) return m1*m1*a; return m1*m1; }
void PFactor(int x){prime.clear();FOR(i,2,x/i)if(x%i==0){while(x%i==0)x/=i,prime.pb(i);}if (x > 1) prime.pb(x);}
bool isprime (ll a) { if(a<=1) return false; if(a==2||a==3) return true; if(a%2==0||a%3==0) return false; for(ll i=5;i*i<=a;i=i+6) { if(a%i==0||a%(i+2)==0) return false; } return true;}



const int N = 2e6 + 20;
int n=0,m=0,k=0;
ll a=0,b=0;
string str;
ll d[N]={0};
ll f[N]={0};
int g[501][501];
int x,y;
int main()
{
    TC
    {
        cin>>n>>m;
        FOR(i,1,n)FOR(j,1,m)
        {
            char c;
            cin>>c;
            if(c=='.')g[i][j]=0;
            else g[i][j]=1;
        }
        FOR(i,1,n)
        {
            FOR(j,1,m)
            {
                if(i%3==1)g[i][j]=1;
            }
        }
        FOR(i,1,n)
        {
            bool boo=false;
            if(i%3!=2||i==n)continue;
            FOR(j,1,m)
            {
                if(g[i][j]==1)
                {
                    g[i+1][j]=1;
                    boo=true;
                    break;
                }
            }
            if(boo==false)
            {
                FOR(j,1,m)
                {
                    if(g[i+1][j]==1)
                    {
                        g[i][j]=1;
                        boo=true;
                        break;
                    }
                }
            }
            if(boo==false)g[i][1]=g[i+1][1]=1;
        }
        if(n%3==0)
        {
            FOR(i,1,m)
            {
                if(g[n][i]==1)
                {
                    g[n-1][i]=1;
                }
            }
        }
        FOR(i,1,n)
        {
            FOR(j,1,m)
            {
                cout<<(g[i][j]==0?'.':'X');
            }
            cout<<endl;
        }
    }
}