#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <utility>
#include <complex>
#include <chrono>
using namespace std;
using namespace std::chrono;

typedef long long int lli;
typedef long double ld;
typedef vector<lli> vl;
typedef vector<ld> vd;
typedef map<lli,lli> ml;
typedef unordered_map<lli,lli> uml;
typedef pair<lli,lli> pl;
typedef set<lli> sl;
typedef vector<pl> vp;
typedef queue<lli> ql;
typedef priority_queue<lli> pql;
typedef list<lli> ll;
typedef vector<ll> graph;


# define pb push_back
# define mp make_pair
# define f first
# define s second
# define itr iterator
# define MOD 1000000007
# define INF 1000000000000000
# define all(x) x.begin(), x.end()
# define rall(a) a.begin(), a.end(), greater<lli>()
# define ins insert
# define ms(a,x) memset(a, x, sizeof(a))
# define rep(i,n) for(i=0;i<n;i++)
# define wrep(i,a,b) for(i=a;i<b;i++)
# define M 200001
/*
void knapsack(lli n, lli m, vl va, vl vb){
    lli i, w;
    lli k[n+1][m+1];
    k[n][m] = -1;
    for(i=0;i<=n;i++){
        for(w=0;w<=m;w++){
            if(i==0 || w==0) k[i][w]=0;
            else if(va[i-1]<=w) k[i][w] = max(k[i-1][w], k[i-1][w-va[i-1]]+ vb[i-1]);
            else k[i][w] = k[i-1][w];
        }
    }
    cout<<k[n][m]<<endl;
}
bool comp(pl a, pl b){
    return a.f<b.f;
}
bool comp(lli a, lli b){
    return abs(a)<abs(b);
}
lli cmb(lli n, lli r){
    if(n==r){
        return 1;
    }
    lli i, pdt = 1;
    r = max(r,n-r);
    for(i=1;i<=n-r;i++){
        pdt *= (r+i);
        pdt /= i;
    }
    return pdt;
}
lli per(lli n, lli r){
    lli i;
    lli pdt = 1;
    for(i=1;i<=r;i++){
        pdt *= n-r+i;
    }
    return pdt;

}
// Binomial coeff Table // Combination Table
lli dp[2001][2001];
void foo(){
    dp[0][0] = 1;
    lli i, j;
    for (i = 1; i < 1001; i++) {
        dp[i][0] = 1;
        for (j = 1; j <= i; j++) {
            dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % MOD;
        }
    }
}

//cout << fixed << setprecision(9) << ans << endl;
//sieve Table
int sv[M];
vl prm;
void sieve(){
    lli i, j;
    for(i=2;i<M;i++){
      if(sv[i]!=0){
        continue;
      }
      sv[i] = -1;
      prm.pb(i);
      for(j=2;j*i<M;j++){
        sv[i*j] = 1;
      }
    }
    return;
}
lli fexpo(lli a, lli b){
  if(a==1) return 1;
  if(b==0) return 1;
  if(b==1) return a%MOD;
  lli ans = fexpo(a,b/2)%MOD;
  if(b%2==0) return (ans*ans)%MOD;
  else return (((a*ans)%MOD)*ans)%MOD;
}
lli fact[M];
lli inv_fact[M];
void foo(){
  lli i;
  fact[0] = 1;
  for(i=1;i<M;i++){
    fact[i] = (i*fact[i-1])%MOD;
  }
  inv_fact[M-1] = fexpo(fact[M-1],MOD-2);
  for(i=M-2;i>=0;i--){
    inv_fact[i] = ((i+1)*inv_fact[i+1])%MOD;
  }
}
lli cmb(lli n, lli r){
  return (((fact[n]*inv_fact[r])%MOD)*(inv_fact[n-r]))%MOD;
}
void bezout(lli a, lli b, lli &x, lli &y){
  if(a==0){
    x = 0;
    y = 1;
    return;
  }
  lli x1, y1;
  bezout(b%a,a,x1,y1);
  x = y1 - (b/a)*x1;
  y = x1;
  return;
}
*/




void solve(){
    lli n, i, m=0, q=0, mx=-INF, mn=INF, k=0, j=0, c=0, d=0, t = 0, sm = 0, pdt = 1;
    cin >> n;
    //lli v[n];

    char v[n][n];
    pl p1, p2, p3, p4;
    t = 2;


    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        cin >> v[i][j];
        if(v[i][j]=='*' && t==2){
          p1 = mp(i,j);
          t--;
        }
        else if(v[i][j]=='*'){
          p2 = mp(i,j);
          t--;
        }
      }
    }

    if(p1.f==p2.f){
      if(p1.f==0){
        p3.f = p4.f = 1;
      }
      else{
        p3.f = p4.f = 0;
      }
      p3.s = p1.s;
      p4.s = p2.s;
    }
    else if(p1.s==p2.s){
      if(p1.s==0){
        p3.s = p4.s = 1;
      }
      else{
        p3.s = p4.s = 0;
      }
      p3.f = p1.f;
      p4.f = p2.f;
    }
    else{
      p3.f = p1.f;
      p3.s = p2.s;
      p4.s = p1.s;
      p4.f = p2.f;
    }

    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        if((i==p3.f && j==p3.s) || (i==p4.f && j==p4.s)){
          v[i][j] = '*';
        }
      }
    }


    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        cout<<v[i][j];
      }
      cout<<endl;
    }








    //cout<<endl;
    return;
}



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lli t;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    //auto start = high_resolution_clock::now();
    cin >> t;
    //t = 1;
    while(t--){
        solve();
    }

    //auto stop = high_resolution_clock::now();
    //auto duration = duration_cast<microseconds>(stop - start);
    //cout<<"Used : "<< (ld)duration.count()/1000 << " ms" << endl;
    return 0;
}
