#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ed "\n"
int main()
{  
    int t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        char arr[n + 1][n+1];
        ll cnt = 0;
        int FirstX , FirstY, SecondX, SecondY;
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= n; j++)
            {
                cin>>arr[i][j];
                if(arr[i][j] == '*' and cnt == 0)
                {
                    FirstX = i;
                    FirstY = j;
                    cnt++;
                }
                else if(arr[i][j] == '*' and cnt == 1)
                {
                    SecondX = i;
                    SecondY = j;
                }
                
            }
            
        }
        if(FirstX == SecondX)
        {
          
            if(FirstX + 1 > n)
            {
                arr[FirstX - 1][FirstY] = '*';
                arr[SecondX - 1][SecondY] = '*';
            }
            else
            {
                arr[FirstX + 1][FirstY] = '*';
                arr[SecondX + 1][SecondY] = '*';
            }
            
        }
        else if(FirstY == SecondY)
        {
           
            if(FirstY + 1 > n)
            {
              
                arr[FirstX][FirstY-1] = '*';
                arr[SecondX][SecondY - 1] = '*';
            }
            else
            {
               
                arr[FirstX][FirstY + 1] = '*';
                arr[SecondX][SecondY + 1] = '*';
            }
        }
        else
        {
            
            arr[FirstX][SecondY] = '*';
            arr[SecondX][FirstY] = '*';
        }
       
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <=n; j++)
            {
                cout<<arr[i][j];
            }
            cout<<ed;
        }
        

    }
}