#include<iostream>
#include<vector>
using namespace std;

void solve()
{
	int n;
	cin >> n;
	char a[405][405];
	int i, j;
	
	
		vector<int> pos_i, pos_j;
		for (i = 0; i < n; i++)
		{
			for (j = 0; j < n; j++)
			{
				cin >> a[i][j];
				if (a[i][j] == '*')
				{
					pos_i.push_back(i);
					pos_j.push_back(j);
				}
			}
		}

		if (n == 2)
		{
			a[0][0] = '*';
			a[0][1] = '*';
			a[1][0] = '*';
			a[1][1] = '*';
		}
		else
		{
			if (pos_i[0] == pos_i[1])
			{
				if (pos_i[0] != 0)
				{
					a[pos_i[0] - 1][pos_j[0]] = '*';
					a[pos_i[1] - 1][pos_j[1]] = '*';

				}
				else
				{
					a[pos_i[0] + 1][pos_j[0]] = '*';
					a[pos_i[1] + 1][pos_j[1]] = '*';

				}
			}
			else if (pos_j[0] == pos_j[1])
			{
				if (pos_j[0] != 0)
				{
					a[pos_i[0]][pos_j[0] - 1] = '*';
					a[pos_i[1]][pos_j[1] - 1] = '*';

				}
				else
				{
					a[pos_i[0]][pos_j[0] + 1] = '*';
					a[pos_i[1]][pos_j[1] + 1] = '*';

				}
			}
			else
			{
				
				//if (pos_j[0] > pos_j[1])
				{
					a[pos_i[0]][pos_j[1]] = '*';
					a[pos_i[1]][pos_j[0]] = '*';

				}
				/*else
				{
					a[pos_i[0]][pos_j[1]] = '*';
					a[pos_j[0]][pos_i[1]] = '*';

				}*/

				
			}

		}

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

}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		solve();
	}

	return 0;
}