#include <bits/stdc++.h>
using namespace std;
#define int long long int


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;


    while(t--)
    {
        int n;
        cin>>n;
        vector<pair<int,int>> v;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<n;j++)
            {
                char ch;
                cin>>ch;
                if(ch == '*')
                {
                    v.push_back({i,j});
                }
            }
        }
        if(v[0].first!=v[1].first && v[0].second!=v[1].second)
        {
        v.push_back({v[0].first,v[1].second});
        v.push_back({v[1].first,v[0].second});
        }
        else if(v[0].first == v[1].first)
        {
            if(v[0].first>0)
            {
                v.push_back({v[0].first-1,v[0].second});
                v.push_back({v[1].first-1,v[1].second});
            }
            else
            {
                v.push_back({v[0].first+1,v[0].second});
                v.push_back({v[1].first+1,v[1].second});
            }
        }
        else
        {
            if(v[0].second>0)
            {
                v.push_back({v[0].first,v[0].second-1});
                v.push_back({v[1].first,v[1].second-1});
            }
            else
            {
                v.push_back({v[0].first,v[0].second+1});
                v.push_back({v[1].first,v[1].second+1});
            }
        }
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<n;j++)
            {
                int flag = 0;
                for(int k=0;k<4;k++)
                {

                    if(i==v[k].first && j==v[k].second)
                    {
                        flag = 1;
                        break;
                    }
                }
                if(flag==0)
                    cout<<".";
                else
                    cout<<"*";
            }
            cout<<endl;
        }

    }

}
