#include <bits/stdc++.h>
using namespace std;
#define sz(a) int(a.size())
#define pb push_back
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(),c.rend()
#define present(container, element) (container.find(element) != container.end())  //for set and maps works in O(log n)
#define cpresent(container, element) (find(all(container).element) != container.end())  //for vectors works in O(n)
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*n/(gcd(m,n))
// #define INF 100000000
// #define in_range(x,y,n,m) (x>=0 && x<n && y>=0 && y<m)
// #define mod 10000007  //given number is not a prime number
#define int ll
typedef long long ll; // range of int is -2* 10^9 to 2* 10^9
typedef vector< int > vi;
typedef vector< ll > vl;
typedef vector< vi > vvi;
typedef pair< int, int > ii;  

void print(const vi& v){
    for(int i:v)
        cout<<i<<" ";
    cout<<endl; }

void input(vi& v){
    for(int &i:v)
        cin>>i; }

void swap(int *x,int *y){
    *x ^= *y;
    *y ^= *x;
    *x ^= *y;}

int power(int x,int y){
    int num = 1;
    while(y--)
        num *=x;
    return num;}

void solve(){
    int n;
    cin>>n;
    vector<string> a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    vector<ii> pos(4);
    int x=0;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            if(a[i][j]=='*'){
                pos[x].first = i;
                pos[x].second = j;
                x++;
            }
    if(pos[0].first == pos[1].first){
        pos[2].first = pos[0].first==n-1?0:n-1;
        pos[2].second = pos[0].second;
        pos[3].first = pos[2].first;
        pos[3].second = pos[1].second;
    }
    else if(pos[0].second == pos[1].second){
        pos[2].first = pos[0].first;
        pos[2].second = pos[0].second==0?n-1:0;
        pos[3].first = pos[1].first;
        pos[3].second = pos[2].second;
    }
    else{
        pos[2].first = pos[0].first;
        pos[2].second = pos[1].second;
        pos[3].first = pos[1].first;
        pos[3].second = pos[0].second;
    }
    a[pos[2].first][pos[2].second] = '*';
    a[pos[3].first][pos[3].second] = '*';
    for(int i=0;i<n;i++)
        cout<<a[i]<<endl;
}

signed main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t=1;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    cin>>t;
    while(t--){
        solve();
    }
    return 0;}
