#include <bits/stdc++.h>

#define modulus 1000000007

//for loops
//-------------------
#define for0(i, N) for (i = 0; i < (int) N; i++)
#define for1(i, N) for (i = 1; i <= (int) N; i++)
#define forr0(i, N) for (i = (int) N - 1; ~i; i--)
#define forr1(i, N) for (i = (int) N; i; i--)
#define foru(i, l, r, x) for (i = l; i <= r; i += x)
//to declare a for loop,
//first declare the primitive on a separate line
//
// int i;
// for0(i, N){
//      code
// }


//primitives & string
//-------------------
using ll = long long;
using str = std::string;


//pairs
//-----
using ii = std::pair<int, int>;
using llll = std::pair<ll, ll>;
#define mp make_pair
#define fi first
#define se second

using mii = std::map<int, int>;
using mllll = std::map<ll, ll>;


//vectors
//-------------
#define pb push_back
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vii = std::vector<ii>;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vb = std::vector<bool>;


//those grid problems (thanks BenCh)
//----------------------------------
const int dx[] = {1, 0, -1, 0},  dy[] = {0, 1, 0, -1};


//division rounded up and rounded down
//--------
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); }
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); }


using namespace std;

//ACTUAL CODE
//------------------------------------------------------------------------------------------------
//                                                                                                |
//                                                                                                |




void solve(){

    int N; cin >> N;
    vector<pair<int, int>> coords;
    char arr[N][N];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> arr[i][j];
            if (arr[i][j] == '*') {
                coords.pb({i, j});
            }
        }
    }

    if (coords[0].first == coords[1].first) {
        if (coords[1].first == N - 1) {
            arr[N - 2][coords[1].second] = '*';
            arr[N - 2][coords[0].second] = '*';
        }
        else {
            arr[coords[1].first + 1][coords[1].second] = '*';
            arr[coords[0].first + 1][coords[0].second] = '*';
        }
    }
    else if (coords[0].second == coords[1].second) {
            if (coords[0].second == N - 1) {
                arr[coords[0].first][N - 2] = '*';
                arr[coords[1].first][N - 2] = '*';
            }
            else {
                arr[coords[0].first][coords[0].second + 1] = '*';
                arr[coords[1].first][coords[1].second + 1] = '*';
            }
        }
    else {
        arr[coords[0].first][coords[1].second] = '*';
        arr[coords[1].first][coords[0].second] = '*';
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << arr[i][j];
        }
        cout << "\n";
    }

}

int main()
{
    std::ios::sync_with_stdio(0);
    std::cin.tie(0); std::cout.tie(0); std::cout << std::fixed;

    int t; std::cin >> t;
    while(t--) solve();

    return 0;
}






//                                                                                                |
//                                                                                                |
//------------------------------------------------------------------------------------------------




//  NOTES:
//~~~~~~~~~~~~~~~~~~~~~~~~
// debug:
// - check int overflow, out of bounds
// - negative indexing?
//  special cases (n = 1, n = 0?)
//  do something instead of nothing
//  *stay organized*
// - write down IDEAS
// - DON'T GET CAUGHT ON ONE APPROACH
//
//
//
// most of all, maintain absolute concentration - take a break if you must
//
//
