#include <bits/stdc++.h>

using namespace std;

#define fr first
#define sc second
#define ll long long
#define ull unsigned long long
#define pb push_back
#define ppb pop_back

const int INF = 1e9 + 5;
const int mod = 1e9+7;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t;
    cin>>t;
    while(t--) {
        int n;
        cin>>n;
        int x1 = -1, y1, x2, y2, x3, x4, y3, y4;
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                char a;
                cin>>a;
                if(a == '*' && x1 == -1) {
                    x1 = j;
                    y1 = i;
                } else if(a == '*') {
                    x2 = j;
                    y2 = i;
                }
            }
        }
        if(x1 == x2) {
            if(x1 + 1 < n) {
                x3 = x1 + 1;
                x4 = x1 + 1;
            } else {
                x3 = x1 - 1;
                x4 = x3;
            }
            y3 = y1;
            y4 = y2;
        } else if(y1 == y2) {
            if(y1 + 1 < n) {
                y3 = y1 + 1;
                y4 = y3;
            } else {
                y3 = y1 - 1;
                y4 = y3;
            }
            x3 = x1;
            x4 = x2;
        } else {
            x3 = x1;
            y3 = y2;
            x4 = x2;
            y4 = y1;
        }
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                if((j == x1 || j == x2 || j == x3 || j == x4) && (y1 == i || y2 == i || y3 == i || y4 == i)) {
                    cout<<'*';
                } else {
                    cout<<'.';
                }
            }
            cout<<'\n';
        }
    }
    return 0;
}
