for _ in range(int(input())):
n = int(input())
xys = []
for i in range(n):
for j, c in enumerate(input()):
if c == '*':
xys.append((i, j))
(x1, y1), (x2, y2) = xys
if x1 == x2:
x2 = (x1 + 1) % n
elif y1 == y2:
y2 = (y1 + 1) % n
t = [(x1, y1), (x2, y2), (x1, y2), (x2, y1)]
for i in range(n):
print(''.join('.*'[(i, j) in t] for j in range(n)))
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,n,i,j,i1,i2,j1,j2,temp;
char arr[400][400];
cin>>t;
while(t--){
temp=0;
cin>>n;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
cin>>arr[i][j];
if (temp==0 && arr[i][j]=='*')
{
i1=i;
j1=j;
temp=1;
}
else if (temp==1 && arr[i][j]=='*')
{
i2=i;
j2=j;
}
}
}
if(i1==i2)
{
if(i1==n-1)
{
arr[i1-1][j1]='*';
arr[i1-1][j2]='*';
}
else if(i1<n)
{
arr[i1+1][j1]='*';
arr[i1+1][j2]='*';
}
}
else if(j1==j2)
{
if(j1==n-1)
{
arr[i1][j1-1]='*';
arr[i2][j1-1]='*';
}
else if(j1<n)
{
arr[i1][j1+1]='*';
arr[i2][j1+1]='*';
}
}
else
arr[i1][j2]='*';
arr[i2][j1]='*';
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
cout<<arr[i][j];
}
cout<<"\n";
}
}
}
1293B - JOE is on TV | 1584A - Mathematical Addition |
1660B - Vlad and Candies | 1472C - Long Jumps |
1293D - Aroma's Search | 918A - Eleven |
1237A - Balanced Rating Changes | 1616A - Integer Diversity |
1627B - Not Sitting | 1663C - Pōja Verdon |
1497A - Meximization | 1633B - Minority |
688B - Lovely Palindromes | 66B - Petya and Countryside |
1557B - Moamen and k-subarrays | 540A - Combination Lock |
1553C - Penalty | 1474E - What Is It |
1335B - Construct the String | 1004B - Sonya and Exhibition |
1397A - Juggling Letters | 985C - Liebig's Barrels |
115A - Party | 746B - Decoding |
1424G - Years | 1663A - Who Tested |
1073B - Vasya and Books | 195B - After Training |
455A - Boredom | 1099A - Snowball |