#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mem0(a) memset(a, 0, sizeof(a))
#define mem1(a) memset(a, -1, sizeof(a))
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

ll lcm(ll a, ll b)
{
    return (a * b) / gcd(a, b);
}

long long binpow(long long base, long long exp, int mod)
{
    long long res = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % mod;
        exp = exp >> 1;
        base = (base * base) % mod;
    }
    return res;
}

void solve()
{
    ll n,i,j;
    cin>>n;
    char c;
    vector<pair<int,int>>v;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            cin>>c;
            if(c=='*')
            {
                v.pb(make_pair(i,j));
            }
        }
    }
    if(v[0].first==v[1].first)
    {
        if(v[0].first!=n-1)
        {
            v.pb(make_pair(v[0].first+1,v[0].second));
            v.pb(make_pair(v[1].first+1,v[1].second));
        }
        else
        {
            v.pb(make_pair(v[0].first-1,v[0].second));
            v.pb(make_pair(v[1].first-1,v[1].second));
        }
    }
    else if(v[0].second==v[1].second)
    {
        if(v[0].second!=n-1)
        {
            v.pb(make_pair(v[0].first,v[0].second+1));
            v.pb(make_pair(v[1].first,v[1].second+1));
        }
        else
        {
            v.pb(make_pair(v[0].first,v[0].second-1));
            v.pb(make_pair(v[1].first,v[1].second-1));
        }
    }
    else
    {
        v.pb(make_pair(v[0].first,v[1].second));
        v.pb(make_pair(v[1].first,v[0].second));
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            int f=0;
            for(auto x:v)
            {
                if(x.first==i&&x.second==j)
                {
                    cout<<'*';
                    f=1;
                }
            }
            if(f==0)
            {
                cout<<'.';
            }
        }
        cout<<"\n";
    }
}

int main()
{
    fio;
    int t = 1;
    cin>>t;
    while (t--)
    {
        solve();
    }
    return 0;
}