#include <bits/stdc++.h>

using namespace std;

#define pll pair<ll, ll>
#define mod 1000000007
#define mp make_pair
#define ll long long int
#define pb push_back
#define ppb pop_back
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repr(i, n, a) for (ll i = n; i > a; i--)
#define vll vector<ll>
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define F first
#define S second

ll gcd(ll x, ll y)
{ //returns gcd of two long long ints
    if (x == 0)
        return y;
    return gcd(y % x, x);
}

ll lcm(ll x, ll y)
{
    return ((x * y) / gcd(x, y));
}

bool isPrime(ll n)
{
    // Corner case
    if (n <= 1)
        return false;

    // Check from 2 to n-1
    for (ll i = 2; i * i < n + 1; i++)
        if (n % i == 0)
            return false;

    return true;
}

ll fact(ll n);

ll nCr(ll n, ll r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
ll fact(ll n)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
        res = res * i;
    return res;
}

int powermod(int x, int y, int p)
{
    int res = 1; // Initialize result

    x = x % p; // Update x if it is more than or
    // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res * x) % p;

        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}

int modInverse(int n, int p)
{
    return powermod(n, p - 2, p);
}

int nCrModPFermat(int n, int r, int p)
{
    // Base case
    if (r == 0)
        return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    int fac[n + 1];
    fac[0] = 1;
    for (int i = 1; i <= n; i++)
        fac[i] = (fac[i - 1] * i) % p;

    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}

vll all_prime(ll n)
{
    vll sieve(n + 1, 0);
    for (ll i = 2; i < n + 1; i++)
    {
        if (sieve[i])
            continue; /* If seive[i]==0 it means its a prime */
        for (ll j = i * i; j < n + 1; j += i)
        {
            if (sieve[j] == 0)
            {
                sieve[j] = i;
            }
        }
    }
    return sieve;
}

vector<ll> factors(ll n)
{
    vector<ll> f;
    for (ll x = 2; x * x <= n; x++)
    {
        while (n % x == 0)
        {
            f.push_back(x);
            n /= x;
        }
    }
    if (n > 1)
        f.push_back(n);
    return f;
}

//***************************** CODE STARTS HERE **************************************

void solve()
{
    ll n;
    cin >> n;
    vector<string> a;
    rep(i, 0, n)
    {
        string s;
        cin >> s;
        a.pb(s);
    }
    int f = -1, s = -1, o = -1, k = -1;
    rep(i, 0, n)
    {
        string t = a[i];
        rep(j, 0, t.size())
        {
            if (t[j] == '*')
            {
                if (f == -1)
                    f = i, o = j;
                else
                    s = i, k = j;
            }
        }
    }

    string t = a[f];
    t[k] = '*';
    a[f] = t;
    t = a[s];
    t[o] = '*';
    a[s] = t;
    if (f == s)
    {
        if (f != n - 1)
            f++, s++;
        else
            f--, s--;
        t = a[f];
        t[k] = '*';
        a[f] = t;
        t = a[s];
        t[o] = '*';
        a[s] = t;
    }
    if (o == k)
    {
        string m = a[f];
        if (o != m.size() - 1)
            o++;
        else
            o--;
        m = a[s];
        if (k != m.size() - 1)
            k++;
        else
            k--;
        t = a[f];
        t[k] = '*';
        a[f] = t;
        t = a[s];
        t[o] = '*';
        a[s] = t;
    }

    rep(i, 0, n) cout << a[i] << endl;

    return;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
