#include "bits/stdc++.h"

//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;

using namespace std;
#define ll              long long int
#define ld              long double
#define mod             1000000007
#define modm            998244353
#define maxdef          undefined
#define inf             1e18
#define vi              vector<int>
#define vii             vector<ll>
#define nline           "\n"
#define pb              push_back
#define vs              vector<string>
#define vip             vector<pi>
#define pi              pair<int,int>
#define pii             pair<ll,ll>
#define ump             unordered_map
#define mp              make_pair
#define pq_max          priority_queue<ll>
#define pq_min          priority_queue<ll,vi,greater<ll>>
#define sz(x)           (int)((x).size())
#define all(n)          n.begin(),n.end()
#define ff              first
#define ss              second
#define mid(l,r)        (l+(r-l)/2)
#define bitc(n)         __builtin_popcount(n)
#define bitcll(n)       __builtin_popcountll(n)
#define loop(i,a,b)     for(int i=(a);i<=(b);i++)
#define looprev(i,a,b)  for(int i=(a);i>=(b);i--)
#define iter(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define log(args...)    { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define logarr(arr,a,b) for(int z=(a);z<=(b);z++) cout<<(arr[z])<<" ";cout<<endl;   
#define log(args...)    { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define logarr(arr,a,b) for(int z=(a);z<=(b);z++) cout<<(arr[z])<<" ";cout<<endl;   
template <typename T> T gcd(T a, T b){if(a%b) return gcd(b,a%b);return b;}
template <typename T> T lcm(T a, T b){return (a*(b/gcd(a,b)));}
vs tokenizer(string str,char ch) {std::istringstream var((str)); vs v; string t; while(getline((var), t, (ch))) {v.pb(t);} return v;}


void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pbtrie;

/**************************************************************************************************/
vip directions = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
vip half_directions = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; 
//Write Global veriables here...


/**************************************************************************************************/

void file_i_o()
{
    ios_base::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

/**************************************************************************************************/

void solve(){
    //Write here code...
    int n;
    cin>>n;
    char a[405][405];
    vector<pair<int,int>>pt;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
            if(a[i][j]=='*') pt.push_back({i,j});
        }
    }
    if(pt[0].first == pt[1].first){
        if(pt[0].first==0){
            a[pt[0].first+1][pt[0].second]='*';
            a[pt[1].first+1][pt[1].second]='*';
        }
        else{
            a[0][pt[0].second]='*';
            a[0][pt[1].second]='*';
        }
    }
    else if(pt[0].second == pt[1].second){
        if(pt[0].second==0){
            a[pt[0].first][pt[0].second+1]='*';
            a[pt[1].first][pt[1].second+1]='*';
        }
        else{
            a[pt[0].first][0]='*';
            a[pt[1].first][0]='*';
        }
    }
    else{
        sort(pt.begin(),pt.end());
        a[pt[0].first][pt[1].second]='*';
        a[pt[1].first][pt[0].second]='*';
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout<<a[i][j];
        }
        cout<<"\n";
    }   
}

/**************************************************************************************************/

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