There is a square field of size $n \times n$ in which two cells are marked. These cells can be in the same row or column.

You are to mark two more cells so that they are the corners of a rectangle with sides parallel to the coordinate axes.

For example, if $n=4$ and a rectangular field looks like this (there are asterisks in the marked cells):

$$ \begin{matrix} . & . & * & . \\ . & . & . & . \\ * & . & . & . \\ . & . & . & . \\ \end{matrix} $$

Then you can mark two more cells as follows

$$ \begin{matrix} * & . & * & . \\ . & . & . & . \\ * & . & * & . \\ . & . & . & . \\ \end{matrix} $$

If there are several possible solutions, then print any of them.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 400$). Then $t$ test cases follow.

The first row of each test case contains a single integer $n$ ($2 \le n \le 400$) — the number of rows and columns in the table.

The following $n$ lines each contain $n$ characters '.' or '*' denoting empty and marked cells, respectively.

It is guaranteed that the sums of $n$ for all test cases do not exceed $400$.

It is guaranteed that there are exactly two asterisks on the field. They can be in the same row/column.

It is guaranteed that the solution exists.


-----Output-----

For each test case, output $n$ rows of $n$ characters — a field with four asterisks marked corresponding to the statements. If there multiple correct answers, print any of them.


-----Examples-----

Input
6
4
..*.
....
*...
....
2
*.
.*
2
.*
.*
3
*.*
...
...
5
.....
..*..
.....
.*...
.....
4
....
....
*...
*...
Output
*.*.
....
*.*.
....
**
**
**
**
*.*
*.*
...
.....
.**..
.....
.**..
.....
....
....
**..
**..


-----Note-----

None

Difficulty: EASY

Solutions:
for _ in range(int(input())):
	n = int(input())
	l = list()
	r = list()
	for i in range(n):
		k = list(input())
		l.append(k)
	for i in range(n):
		if '*' in l[i]:
			if l[i].count('*') > 1:
				for t in range(n):
					if l[i][t] == '*':
						k = []
						k.append(i)
						k.append(t)
						r.append(k)
				break
			else:
				k = []
				k.append(i)
				k.append(l[i].index('*'))
				r.append(k)
	fr = r[0][0]
	fc = r[0][1]
	sr = r[1][0]
	sc = r[1][1]
	if fr == sr:
		try:
			l[fr + 1][fc] = '*'
			l[sr + 1][sc] = '*'
		except:
			l[fr - 1][fc] = '*'
			l[sr - 1][sc] = '*'
	elif fc == sc:
		try:
			l[fr][fc + 1] = '*'
			l[sr][sc + 1] = '*'
		except:
			l[fr][fc - 1] = '*'
			l[sr][sc - 1] = '*'
	else:
		l[fr][sc] = '*'
		l[sr][fc] = '*'
	for i in range(n):
		for j in range(n):
			print(l[i][j], end='')
		print()


for tc in range(int(input())):
	n = int(input())
	a = []
	for i in range(n):
		a.append(list(input()))
	t = [i.count('*') for i in a]
	if 2 in t:
		on = t.index(2)
		dot = [i for i in range(len(a[on])) if a[on][i] == '*']
		if on == 0:
			for i in dot:
				a[1][i] = '*'
			for i in a:
				print(''.join(i))
		if on != 0:
			for i in dot:
				a[0][i] = '*'
			for i in a:
				print(''.join(i))
	else:
		k = [i for i in range(n) if t[i] == 1]
		k1 = a[k[0]].index('*')
		k2 = a[k[1]].index('*')
		if k1 == k2:
			if k1 == 0:
				a[k[0]][1] = '*'
				a[k[1]][1] = '*'
			else:
				a[k[0]][0] = '*'
				a[k[1]][0] = '*'
			for i in a:
				print(''.join(i))
		else:
			a[k[0]][k2] = '*'
			a[k[1]][k1] = '*'
			for i in a:
				print(''.join(i))


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	n = ini()
	b = []
	a = [list(ins()) for i in range(n)]
	for y in range(n):
		for x in range(n):
			if a[y][x] == '*':
				b.append([y, x])
	if b[0][0] == b[1][0]:
		if b[0][0] == 0:
			b[0][0] += 1
			b[1][0] += 1
		else:
			b[0][0] -= 1
			b[1][0] -= 1
	elif b[0][1] == b[1][1]:
		if b[0][1] == 0:
			b[0][1] += 1
			b[1][1] += 1
		else:
			b[0][1] -= 1
			b[1][1] -= 1
	else:
		(b[0][0], b[0][1], b[1][0], b[1][1]) = (b[0][0], b[1][1], b[1][0], b[0][1])
	a[b[0][0]][b[0][1]] = '*'
	a[b[1][0]][b[1][1]] = '*'
	out([''.join(i) for i in a])


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(list(input()))
	x = []
	for j in range(n):
		for k in range(n):
			if l[j][k] == '*':
				x.append([j, k])
	if x[0][0] == x[1][0]:
		if x[0][0] == 0:
			l[1][x[0][1]] = '*'
			l[1][x[1][1]] = '*'
		elif x[0][0] == n - 1:
			l[n - 2][x[0][1]] = '*'
			l[n - 2][x[1][1]] = '*'
		else:
			l[x[0][0] + 1][x[0][1]] = '*'
			l[x[0][0] + 1][x[1][1]] = '*'
	elif x[0][1] == x[1][1]:
		if x[0][1] == 0:
			l[x[0][0]][1] = '*'
			l[x[1][0]][1] = '*'
		elif x[0][1] == n - 1:
			l[x[0][0]][n - 2] = '*'
			l[x[1][0]][n - 2] = '*'
		else:
			l[x[0][0]][x[0][1] + 1] = '*'
			l[x[1][0]][x[0][1] + 1] = '*'
	else:
		l[x[0][0]][x[1][1]] = '*'
		l[x[1][0]][x[0][1]] = '*'
	for ss in range(n):
		for sss in range(n):
			print(l[ss][sss], end='')
		print()


num = int(input())
for _ in range(num):
	n = int(input())
	arrays = []
	for i in range(n):
		arr = [str(x) for x in input()]
		arrays.append(arr)
	star = []
	for i in range(n):
		for j in range(n):
			if arrays[i][j] == '*':
				star.append([i, j])
	(x1, y1) = (star[0][0], star[0][1])
	(x2, y2) = (star[1][0], star[1][1])
	if x1 == x2:
		if x1 - 1 >= 0:
			arrays[x1 - 1][y1] = '*'
			arrays[x2 - 1][y2] = '*'
		else:
			arrays[x1 + 1][y1] = '*'
			arrays[x2 + 1][y2] = '*'
	elif y1 == y2:
		if y1 - 1 >= 0:
			arrays[x1][y1 - 1] = '*'
			arrays[x2][y2 - 1] = '*'
		else:
			arrays[x1][y1 + 1] = '*'
			arrays[x2][y2 + 1] = '*'
	else:
		arrays[x1][y2] = '*'
		arrays[x2][y1] = '*'
	for i in range(len(arrays)):
		str1 = ''.join(arrays[i])
		print(str1)


t = int(input())
for i in range(t):
	n = int(input())
	matrix = ['' for x in range(n)]
	(x1, x2, y1, y2) = (1000000000.0, 0, 1000000000.0, 0)
	(xx1, xx2, yy1, yy2) = (0, 0, 0, 0)
	for r in range(n):
		matrix[r] = input()
		for c in range(n):
			if matrix[r][c] == '*':
				if r < x1:
					x1 = r
				if r > x2:
					x2 = r
				if c < y1:
					y1 = c
				if c > y2:
					y2 = c
	if x1 == x2:
		if x1 < n - 1:
			(xx1, xx2) = (x1 + 1, x1 + 1)
		else:
			(xx1, xx2) = (x1 - 1, x1 - 1)
	else:
		xx1 = min(x1, x2)
		xx2 = max(x1, x2)
	if y1 == y2:
		if y1 < n - 1:
			(yy1, yy2) = (y1 + 1, y2 + 1)
		else:
			(yy1, yy2) = (y1 - 1, y2 - 1)
	else:
		yy1 = min(y1, y2)
		if matrix[xx1][yy1] == '*':
			yy1 = max(y1, y2)
			yy2 = min(y1, y2)
		else:
			yy2 = max(y1, y2)
	matrix[xx1] = matrix[xx1][0:yy1] + '*' + matrix[xx1][yy1 + 1:]
	matrix[xx2] = matrix[xx2][0:yy2] + '*' + matrix[xx2][yy2 + 1:]
	for mx in matrix:
		print(mx)


for _ in range(int(input())):
	len_side = int(input())
	mat = []
	for line in range(len_side):
		mat.append(list(input()))
	tmp = []
	cnt = 0
	for (i, line) in enumerate(mat):
		for (j, v) in enumerate(line):
			if v == '*':
				tmp.append([i, j])
				cnt += 1
			if cnt == 2:
				break
	if tmp[0][0] == tmp[1][0]:
		if tmp[0][0] == len_side - 1:
			mat[tmp[0][0] - 1][tmp[0][1]] = '*'
			mat[tmp[0][0] - 1][tmp[1][1]] = '*'
		else:
			mat[tmp[0][0] + 1][tmp[0][1]] = '*'
			mat[tmp[0][0] + 1][tmp[1][1]] = '*'
	elif tmp[0][1] == tmp[1][1]:
		if tmp[1][1] == len_side - 1:
			mat[tmp[0][0]][tmp[1][1] - 1] = '*'
			mat[tmp[1][0]][tmp[1][1] - 1] = '*'
		else:
			mat[tmp[0][0]][tmp[1][1] + 1] = '*'
			mat[tmp[1][0]][tmp[1][1] + 1] = '*'
	else:
		mat[tmp[0][0]][tmp[1][1]] = '*'
		mat[tmp[1][0]][tmp[0][1]] = '*'
	for line in mat:
		print(''.join(line))


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
import math as mt
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
mod = int(1000000000.0) + 7

def power(k, n):
	if n == 0:
		return 1
	if n % 2:
		return power(k, n - 1) * k % mod
	t = power(k, n // 2)
	return t * t % mod

def totalPrimeFactors(n):
	count = 0
	if n % 2 == 0:
		count += 1
		while n % 2 == 0:
			n //= 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			count += 1
			while n % i == 0:
				n //= i
		i += 2
	if n > 2:
		count += 1
	return count

def main():
	for _ in range(int(input())):
		n = int(input())
		a = []
		st = []
		for i in range(n):
			t = input()
			k = []
			c = 0
			for j in t:
				if j == '*' or j == '.':
					k.append(j)
					if j == '*':
						st.append([i, c])
				c += 1
			a.append(k)
		if st[0][0] == st[1][0]:
			if st[0][0]:
				a[st[0][0] - 1][st[0][1]] = '*'
				a[st[0][0] - 1][st[1][1]] = '*'
			else:
				a[st[0][0] + 1][st[0][1]] = '*'
				a[st[0][0] + 1][st[1][1]] = '*'
		elif st[0][1] == st[1][1]:
			if st[0][1]:
				a[st[0][0]][st[0][1] - 1] = '*'
				a[st[1][0]][st[1][1] - 1] = '*'
			else:
				a[st[0][0]][st[0][1] + 1] = '*'
				a[st[1][0]][st[1][1] + 1] = '*'
		else:
			st.sort()
			a[st[0][0]][st[1][1]] = '*'
			a[st[1][0]][st[0][1]] = '*'
		for i in a:
			for j in i:
				print(j, end='')
			print('')
	return
main()


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import *
from statistics import *
from math import *
import fractions
import copy
from copy import deepcopy
import sys
import io
sys.setrecursionlimit(10000)
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7
import random
from random import *
from time import time

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def normalncr(n, r):
	r = min(r, n - r)
	count = 1
	for i in range(n - r, n + 1):
		count *= i
	for i in range(1, r + 1):
		count //= i
	return count
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def get_list():
	return list(map(int, input().split()))

def get_str_list_in_int():
	return [int(i) for i in list(input())]

def get_str_list():
	return list(input())

def get_map():
	return map(int, input().split())

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

def swap(a, b):
	return (b, a)

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

def is_prime(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return 0
	return 1

def prime_factors(n):
	while n % 2 == 0:
		return [2] + prime_factors(n // 2)
	sqrta = int(sqrt(n))
	for i in range(3, sqrta + 1, 2):
		if n % i == 0:
			return [i] + prime_factors(n // i)
	return [n]

def p(a):
	if type(a) == str:
		print(a + '\n')
	else:
		print(str(a) + '\n')

def ps(a):
	if type(a) == str:
		print(a)
	else:
		print(str(a))

def kth_no_not_div_by_n(n, k):
	return k + (k - 1) // (n - 1)

def forward_array(l):
	n = len(l)
	stack = []
	forward = [0] * n
	for i in range(len(l) - 1, -1, -1):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			forward[i] = len(l)
		else:
			forward[i] = stack[-1]
		stack.append(i)
	return forward

def backward_array(l):
	n = len(l)
	stack = []
	backward = [0] * n
	for i in range(len(l)):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			backward[i] = -1
		else:
			backward[i] = stack[-1]
		stack.append(i)
	return backward
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for i in range(int(input())):
	n = int(input())
	l = [0] * n
	m = []
	for i in range(n):
		l[i] = list(input())
		for b in range(n):
			if l[i][b] == '*':
				a = i
				m.append([a, b])
	if m[0][0] == m[1][0] or m[0][1] == m[1][1]:
		if m[0][0] == m[1][0]:
			horizontal = 1
			if m[0][0] == 0:
				x1 = 1
				y1 = m[0][1]
				l[x1][y1] = '*'
				y1 = m[1][1]
				l[x1][y1] = '*'
			else:
				x1 = 0
				y1 = m[0][1]
				l[x1][y1] = '*'
				y1 = m[1][1]
				l[x1][y1] = '*'
		elif m[0][1] == 0:
			y1 = 1
			x1 = m[0][0]
			l[x1][y1] = '*'
			x1 = m[1][0]
			l[x1][y1] = '*'
		else:
			y1 = 0
			x1 = m[0][0]
			l[x1][y1] = '*'
			x1 = m[1][0]
			l[x1][y1] = '*'
	else:
		x1 = m[0][0]
		y1 = m[1][1]
		l[x1][y1] = '*'
		x1 = m[1][0]
		y1 = m[0][1]
		l[x1][y1] = '*'
	for i in l:
		print(''.join(i))


def soln(matrix, n):
	r = []
	c = []
	for i in range(n):
		if len(r) == 2:
			break
		for j in range(n):
			if matrix[i][j] == '*':
				r.append(i)
				c.append(j)
	if r[0] == r[1]:
		if r[0] == 0:
			matrix[1] = matrix[0]
		else:
			matrix[r[0] - 1] = matrix[r[0]]
	elif c[0] == c[1]:
		string = ''
		if c[0] == 0:
			for i in range(n):
				if i == c[0] or i == c[0] + 1:
					string += '*'
				else:
					string += '.'
		else:
			for i in range(n):
				if i == c[0] or i == c[0] - 1:
					string += '*'
				else:
					string += '.'
		matrix[r[0]] = string
		matrix[r[1]] = string
	else:
		string = ''
		for i in range(n):
			if i == c[0] or i == c[1]:
				string += '*'
			else:
				string += '.'
		matrix[r[0]] = string
		matrix[r[1]] = string
	return matrix
t = int(input())
for _ in range(t):
	n = int(input())
	matrix = []
	for i in range(n):
		arr = input()
		matrix.append(arr)
	matrix = soln(matrix, n)
	for i in matrix:
		print(i)


from sys import stdin
input = stdin.readline
for test in range(int(input())):
	n = int(input())
	lst = [''] * n
	store = []
	for i in range(n):
		lst[i] = input().strip()
		if '*' in lst[i]:
			store.append([i, lst[i].index('*')])
	l = len(store)
	if l == 2:
		if store[0][1] == store[1][1]:
			if store[0][1] == 0:
				temp = lst[store[0][0]]
				temp = '**' + temp[2:]
				lst[store[0][0]] = temp
				lst[store[1][0]] = temp
			else:
				temp = lst[store[0][0]]
				temp = temp[:store[0][1] - 1] + '**' + temp[store[0][1] + 1:]
				lst[store[0][0]] = temp
				lst[store[1][0]] = temp
		temp = lst[store[0][0]]
		temp = temp[:store[1][1]] + '*' + temp[store[1][1] + 1:]
		lst[store[0][0]] = temp
		temp = lst[store[1][0]]
		temp = temp[:store[0][1]] + '*' + temp[store[0][1] + 1:]
		lst[store[1][0]] = temp
	else:
		try:
			lst[store[0][0] + 1] = lst[store[0][0]]
		except IndexError:
			lst[store[0][0] - 1] = lst[store[0][0]]
	print(*lst, sep='\n')


t = int(input())
while t > 0:
	n = int(input())
	s = []
	for i in range(n):
		s.append(input())
	cord = []
	for i in range(n):
		for j in range(n):
			if s[i][j] == '*':
				cord.append((i, j))
	(cord1, cord2) = cord
	if cord1[0] == cord2[0]:
		if cord1[0] == 0:
			cord.append((1, cord1[1]))
			cord.append((1, cord2[1]))
		else:
			cord.append((0, cord1[1]))
			cord.append((0, cord2[1]))
	elif cord1[1] == cord2[1]:
		if cord1[1] == 0:
			cord.append((cord1[0], 1))
			cord.append((cord2[0], 1))
		else:
			cord.append((cord1[0], 0))
			cord.append((cord2[0], 0))
	else:
		cord.append((cord1[0], cord2[1]))
		cord.append((cord2[0], cord1[1]))
	x = [i[0] for i in cord]
	y = [i[1] for i in cord]
	for i in range(n):
		for j in range(n):
			if i in x and j in y:
				print('*', end='')
			else:
				print('.', end='')
		print('')
	t -= 1


for t in range(int(input())):
	n = int(input())
	ss = []
	a = []
	one_line = 0
	for i in range(n):
		ss.append(input())
	for i in range(n):
		for j in range(n):
			if ss[i][j] == '*':
				a.append((i, j))
	if a[0][0] == a[1][0]:
		if a[0][0] == 0:
			a.append((1, a[0][1]))
			a.append((1, a[1][1]))
		else:
			a.append((a[0][0] - 1, a[0][1]))
			a.append((a[1][0] - 1, a[1][1]))
	elif a[0][1] == a[1][1]:
		if a[0][1] == 0:
			a.append((a[0][0], 1))
			a.append((a[1][0], 1))
		else:
			a.append((a[0][0], a[0][1] - 1))
			a.append((a[1][0], a[1][1] - 1))
	else:
		a.append((a[0][0], a[1][1]))
		a.append((a[1][0], a[0][1]))
	for i in range(n):
		for j in range(n):
			if (i, j) in a:
				print('*', end='')
			else:
				print('.', end='')
		print()


for _ in range(int(input())):
	n = int(input())
	li = []
	points = []
	po = []
	for i in range(n):
		x = input()
		y = []
		for j in range(n):
			if x[j] == '.':
				y.append('.')
			else:
				y.append('*')
				po.append(i)
				po.append(j)
		li.append(y)
	if po[0] != po[2] and po[1] != po[3]:
		li[po[0]][po[3]] = '*'
		li[po[2]][po[1]] = '*'
	else:
		if po[1] == po[3]:
			if po[1] + 1 != n:
				li[po[0]][po[1] + 1] = '*'
				li[po[2]][po[3] + 1] = '*'
			else:
				li[po[0]][po[1] - 1] = '*'
				li[po[2]][po[3] - 1] = '*'
		if po[0] == po[2]:
			if po[0] + 1 != n:
				li[po[0] + 1][po[1]] = '*'
				li[po[2] + 1][po[3]] = '*'
			else:
				li[po[0] - 1][po[1]] = '*'
				li[po[2] - 1][po[3]] = '*'
	for i in li:
		print(''.join(i))


n = int(input())

def solve(l):
	coord = []
	for i in range(len(l)):
		for j in range(len(l)):
			if l[i][j] == '*':
				coord.append((i, j))
	return coord
for i in range(n):
	a = int(input())
	l = []
	for i in range(a):
		l.append(list(input()))
	c = solve(l)
	x = c[0][0]
	y = c[0][1]
	x2 = c[1][0]
	y2 = c[1][1]
	if x != x2 and y != y2:
		l[x][y2] = '*'
		l[x2][y] = '*'
	elif x == x2:
		if x == a - 1:
			l[x - 1][y2] = '*'
			l[x2 - 1][y] = '*'
		else:
			l[x + 1][y2] = '*'
			l[x2 + 1][y] = '*'
	elif y == y2:
		if y == a - 1:
			l[x][y2 - 1] = '*'
			l[x2][y - 1] = '*'
		else:
			l[x][y2 + 1] = '*'
			l[x2][y + 1] = '*'
	for k in range(len(l)):
		print(''.join(l[k]))


import sys
sys.setrecursionlimit(10 ** 6)

def main(t):
	n = int(input())
	matrix = []
	row = 0
	track = []
	for i in range(n):
		col = 0
		k = input()
		for i in k:
			if i == '*':
				track.append(row)
				track.append(col)
			col += 1
		row += 1
		matrix.append(k)
	(r1, c1, r2, c2) = track
	if r1 == r2:
		if r1 + 1 < n:
			matrix[r1 + 1] = matrix[r1]
		else:
			matrix[r1 - 1] = matrix[r1]
	elif c1 == c2:
		if c1 + 1 < n:
			k = matrix[r1][:c1 + 1] + '*' + matrix[r1][c1 + 2:]
		else:
			k = matrix[r1][:c1 - 1] + '*' + matrix[r1][c1:]
		matrix[r1] = matrix[r2] = k
	else:
		matrix[r1] = matrix[r1][:c2] + '*' + matrix[r1][c2 + 1:]
		matrix[r2] = matrix[r1][:c1] + '*' + matrix[r1][c1 + 1:]
	print(*matrix, sep='\n')
	if t > 1:
		main(t - 1)
main(int(input()))


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter
from pprint import pprint
from itertools import permutations
from bisect import bisect_right
import heapq

def main():
	n = int(input())
	grid = []
	pos = []
	for i in range(n):
		grid.append([c for c in input()])
		for j in range(n):
			if grid[i][j] == '*':
				pos.append((i, j))
	if pos[0][0] == pos[1][0]:
		r = pos[0][0]
		grid[(r + 1) % n][pos[0][1]] = '*'
		grid[(r + 1) % n][pos[1][1]] = '*'
	elif pos[0][1] == pos[1][1]:
		r = pos[0][1]
		grid[pos[0][0]][(r + 1) % n] = '*'
		grid[pos[1][0]][(r + 1) % n] = '*'
	else:
		grid[pos[0][0]][pos[1][1]] = '*'
		grid[pos[1][0]][pos[0][1]] = '*'
	for li in grid:
		print(''.join(li))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	main()


for _ in range(int(input())):
	n = int(input())
	g = [list(input()) for _ in range(n)]
	(r1, c1, r2, c2) = (-1, -1, -1, -1)
	for i in range(n):
		for j in range(n):
			if g[i][j] == '*':
				if r1 < 0:
					(r1, c1) = (i, j)
				else:
					(r2, c2) = (i, j)
	if r1 == r2:
		r = (r1 + 1) % n
		g[r][c1] = g[r][c2] = '*'
	elif c1 == c2:
		c = (c1 + 1) % n
		g[r1][c] = g[r2][c] = '*'
	else:
		g[min(r1, r2)][min(c1, c2)] = g[min(r1, r2)][max(c1, c2)] = g[max(r1, r2)][min(c1, c2)] = g[max(r1, r2)][max(c1, c2)] = '*'
	for v in g:
		print(''.join(v))


t = int(input())
for z in range(t):
	n = int(input())
	arr = []
	for i in range(n):
		field = input()
		arr.append(list(field))
	posi = []
	for y in range(n):
		for x in range(n):
			if arr[y][x] == '*':
				posi.append([x, y])
	if posi[0][0] != posi[1][0] and posi[0][1] != posi[1][1]:
		arr[posi[1][1]][posi[0][0]] = '*'
		arr[posi[0][1]][posi[1][0]] = '*'
	elif posi[0][0] == posi[1][0] and posi[0][1] != posi[1][1]:
		if posi[0][0] == n - 1:
			arr[posi[0][1]][posi[0][0] - 1] = '*'
			arr[posi[1][1]][posi[1][0] - 1] = '*'
		else:
			arr[posi[0][1]][posi[0][0] + 1] = '*'
			arr[posi[1][1]][posi[1][0] + 1] = '*'
	elif posi[0][1] == n - 1:
		arr[posi[0][1] - 1][posi[0][0]] = '*'
		arr[posi[1][1] - 1][posi[1][0]] = '*'
	else:
		arr[posi[0][1] + 1][posi[0][0]] = '*'
		arr[posi[1][1] + 1][posi[1][0]] = '*'
	for i in range(n):
		print(''.join(arr[i]))


for _ in range(int(input())):
	k = int(input())
	l = []
	for i in range(k):
		l.append(list(input()))
	index = []
	for i in range(k):
		for j in range(k):
			if l[i][j] == '*':
				index.append([i, j])
	if index[0][0] == index[1][0]:
		if index[0][0] == k - 1:
			l[-2][index[0][1]] = '*'
			l[-2][index[1][1]] = '*'
		else:
			l[index[0][0] + 1][index[0][1]] = '*'
			l[index[0][0] + 1][index[1][1]] = '*'
	elif index[0][1] == index[1][1]:
		if index[0][1] == k - 1:
			l[index[0][0]][-2] = '*'
			l[index[1][0]][-2] = '*'
		else:
			l[index[0][0]][index[0][1] + 1] = '*'
			l[index[1][0]][index[1][1] + 1] = '*'
	else:
		l[index[0][0]][index[1][1]] = '*'
		l[index[1][0]][index[0][1]] = '*'
	for i in l:
		for j in i:
			print(j, end='')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	pos_r = []
	pos_c = []
	rows = []
	for i in range(n):
		rows.append(list(input()))
		for (j, c) in enumerate(rows[-1]):
			if c == '*':
				pos_r.append(i)
				pos_c.append(j)
	if pos_r[0] == pos_r[1]:
		r = (pos_r[0] + 1) % n
		for c in pos_c:
			rows[r][c] = '*'
	elif pos_c[0] == pos_c[1]:
		c = (pos_c[0] + 1) % n
		for r in pos_r:
			rows[r][c] = '*'
	else:
		for (r, c) in zip(pos_r[::-1], pos_c):
			rows[r][c] = '*'
	rows = '\n'.join((''.join(row) for row in rows))
	print(rows)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = []
	for i in range(n):
		a.append(input())
	x = []
	y = []
	for i in range(n):
		for j in range(n):
			if a[i][j] == '*':
				x.append(i)
				y.append(j)
	if x[0] == x[1]:
		i = 0
		while i == x[0]:
			i += 1
		mi = min(y[0], y[1])
		ma = max(y[0], y[1])
		a[i] = a[i][0:mi] + '*' + a[i][mi + 1:ma] + '*' + a[i][ma + 1:]
	elif y[0] == y[1]:
		j = 0
		while j == y[0]:
			j += 1
		a[x[0]] = a[x[0]][:j] + '*' + a[x[0]][j + 1:]
		a[x[1]] = a[x[1]][:j] + '*' + a[x[1]][j + 1:]
	else:
		a[x[0]] = a[x[0]][:y[1]] + '*' + a[x[0]][y[1] + 1:]
		a[x[1]] = a[x[1]][:y[0]] + '*' + a[x[1]][y[0] + 1:]
	for i in range(n):
		print(a[i])


for _ in range(int(input())):
	n = int(input())
	s = [list(input().strip()) for i in range(n)]
	cand = []
	for i in range(n):
		for j in range(n):
			if s[i][j] == '*':
				cand.append([i, j])
	if cand[0][0] != cand[1][0] and cand[0][1] != cand[1][1]:
		s[cand[1][0]][cand[0][1]] = '*'
		s[cand[0][0]][cand[1][1]] = '*'
	elif cand[0][0] == cand[1][0]:
		if 0 <= cand[0][0] + 1 < n:
			s[cand[0][0] + 1][cand[0][1]] = '*'
			s[cand[1][0] + 1][cand[1][1]] = '*'
		else:
			s[cand[0][0] - 1][cand[0][1]] = '*'
			s[cand[1][0] - 1][cand[1][1]] = '*'
	elif cand[0][1] == cand[1][1]:
		if 0 <= cand[0][1] + 1 < n:
			s[cand[0][0]][cand[0][1] + 1] = '*'
			s[cand[1][0]][cand[0][1] + 1] = '*'
		else:
			s[cand[0][0]][cand[0][1] - 1] = '*'
			s[cand[1][0]][cand[0][1] - 1] = '*'
	for i in s:
		print(''.join(i))


t = int(input())
for _ in range(t):
	n = int(input())
	field = [[0] for _ in range(n)]
	dots = [[0, 0], [0, 0]]
	di = 0
	for i in range(n):
		field[i] = list(input())
		for j in range(n):
			if '*' == field[i][j]:
				dots[di] = (i, j)
				di += 1
	if dots[0][0] != dots[1][0] and dots[0][1] != dots[1][1]:
		field[dots[0][0]][dots[1][1]] = '*'
		field[dots[1][0]][dots[0][1]] = '*'
	elif dots[0][0] == dots[1][0]:
		if dots[0][0] != n - 1:
			field[dots[0][0] + 1][dots[0][1]] = '*'
			field[dots[1][0] + 1][dots[1][1]] = '*'
		else:
			field[dots[0][0] - 1][dots[0][1]] = '*'
			field[dots[0][0] - 1][dots[1][1]] = '*'
	elif dots[0][1] == dots[1][1]:
		if dots[0][1] != n - 1:
			field[dots[0][0]][dots[0][1] + 1] = '*'
			field[dots[1][0]][dots[1][1] + 1] = '*'
		else:
			field[dots[0][0]][dots[0][1] - 1] = '*'
			field[dots[1][0]][dots[1][1] - 1] = '*'
	for i in range(n):
		print(''.join(field[i]))


for _ in range(int(input())):
	n = int(input())
	a = []
	s1 = []
	s2 = []
	for i in range(n):
		x = input()
		for (z, j) in enumerate(x):
			if j == '*':
				if not s1:
					s1 = [i, z]
				else:
					s2 = [i, z]
		a.append(list(x))
	if s1[0] == s2[0]:
		a[(s1[0] + 1) % n][s1[1]] = '*'
		a[(s1[0] + 1) % n][s2[1]] = '*'
	elif s1[1] == s2[1]:
		a[s1[0]][(s1[1] + 1) % n] = '*'
		a[s2[0]][(s2[1] + 1) % n] = '*'
	else:
		a[s1[0]][s2[1]] = '*'
		a[s2[0]][s1[1]] = '*'
	for i in a:
		print(''.join(i))


for _ in range(int(input())):
	n = int(input())
	t = []
	mat = []
	for k in range(n):
		row = [i for i in input()]
		mat.append(row)
	for i in range(n):
		for j in range(n):
			if mat[i][j] == '*':
				t.append((i, j))
	x = t[0]
	y = t[1]
	new = []
	if x[0] == y[0]:
		if x[0] == n - 1:
			new.append((x[0] - 1, x[1]))
			new.append((y[0] - 1, y[1]))
		else:
			new.append((x[0] + 1, x[1]))
			new.append((y[0] + 1, y[1]))
	elif x[1] == y[1]:
		if x[1] == n - 1:
			new.append((x[0], x[1] - 1))
			new.append((y[0], y[1] - 1))
		else:
			new.append((x[0], x[1] + 1))
			new.append((y[0], y[1] + 1))
	else:
		new.append((x[0], y[1]))
		new.append((y[0], x[1]))
	mat[new[0][0]][new[0][1]] = '*'
	mat[new[1][0]][new[1][1]] = '*'
	for row in mat:
		print(''.join(row))


for _ in range(int(input())):
	n = int(input())
	coord = list()
	for i in range(n):
		s = input()
		try:
			idx1 = s.index('*')
			coord.append([i, idx1])
			try:
				idx2 = s.index('*', idx1 + 1)
				coord.append([i, idx2])
			except ValueError:
				continue
		except ValueError:
			continue
	mn_row = min(coord[0][0], coord[1][0])
	y = abs(coord[0][0] - coord[1][0])
	if y == 0:
		y = 1
		if mn_row == n - 1:
			mn_row = n - 2
	mn_col = min(coord[0][1], coord[1][1])
	x = abs(coord[0][1] - coord[1][1])
	if x == 0:
		x = 1
		if mn_col == n - 1:
			mn_col = n - 2
	output = []
	for i in range(n):
		output.append(['.'] * n)
	output[mn_row][mn_col] = '*'
	output[mn_row + y][mn_col] = '*'
	output[mn_row][mn_col + x] = '*'
	output[mn_row + y][mn_col + x] = '*'
	print('\n'.join((''.join(output[r]) for r in range(n))))


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		e = input()
		l.append(list(e))
	ans = []
	for i in range(n):
		for j in range(n):
			if l[i][j] == '*':
				ans.append([i, j])
	(x1, y1) = (ans[0][0], ans[0][1])
	(x2, y2) = (ans[1][0], ans[1][1])
	if x1 == x2:
		if x1 + 1 < n:
			l[x1 + 1][y1] = '*'
			l[x2 + 1][y2] = '*'
		else:
			l[x1 - 1][y1] = '*'
			l[x2 - 1][y2] = '*'
	elif y1 == y2:
		if y1 + 1 < n:
			l[x1][y1 + 1] = '*'
			l[x2][y2 + 1] = '*'
		else:
			l[x1][y1 - 1] = '*'
			l[x2][y2 - 1] = '*'
	else:
		l[x1][y2] = '*'
		l[x2][y1] = '*'
	for k in l:
		print(''.join(k))


for _ in range(int(input())):
	n = int(input())
	graph = []
	data = []
	for i in range(n):
		tmp = list(input())
		graph.append(tmp)
		if '*' in tmp:
			for j in range(len(tmp)):
				if tmp[j] == '*':
					data.append((i, j))
	(x1, y1) = data[0]
	(x2, y2) = data[1]
	if x1 == x2:
		if x1 + 1 < n - 1:
			graph[x1 + 1][y1] = '*'
			graph[x2 + 1][y2] = '*'
		else:
			graph[x1 - 1][y1] = '*'
			graph[x2 - 1][y2] = '*'
	elif y1 == y2:
		if y1 + 1 < n - 1:
			graph[x1][y1 + 1] = '*'
			graph[x2][y2 + 1] = '*'
		else:
			graph[x1][y1 - 1] = '*'
			graph[x2][y2 - 1] = '*'
	else:
		graph[min(x1, x2)][min(y1, y2)] = '*'
		graph[max(x1, x2)][min(y1, y2)] = '*'
		graph[min(x1, x2)][max(y1, y2)] = '*'
		graph[max(x1, x2)][max(y1, y2)] = '*'
	for line in graph:
		print(''.join(line))


for _ in range(int(input())):
	n = int(input())
	arr = []
	for _ in range(n):
		arr.append([w for w in input()])
	p = []
	for i in range(n):
		for j in range(n):
			if arr[i][j] == '*':
				p.append([i, j])
	if p[0][0] == p[1][0] or p[0][1] == p[1][1]:
		if p[0][0] == p[1][0]:
			try:
				arr[p[0][0] + 1][p[0][1]] = '*'
				arr[p[0][0] + 1][p[1][1]] = '*'
			except:
				arr[p[0][0] - 1][p[0][1]] = '*'
				arr[p[0][0] - 1][p[1][1]] = '*'
		else:
			try:
				arr[p[0][0]][p[0][1] + 1] = '*'
				arr[p[1][0]][p[0][1] + 1] = '*'
			except:
				arr[p[0][0]][p[0][1] - 1] = '*'
				arr[p[1][0]][p[0][1] - 1] = '*'
	else:
		arr[p[0][0]][p[1][1]] = '*'
		arr[p[1][0]][p[0][1]] = '*'
	for item in arr:
		for w in item:
			print(w, end='')
		print('')


from sys import stdin
t = int(stdin.readline().strip())
for i in range(t):
	n = int(stdin.readline().strip())
	a = [[-1, -1], [-1, -1]]
	for k in range(n):
		line = stdin.readline().strip()
		for char in range(len(line)):
			if line[char] == '*':
				if a[0][0] == -1:
					a[0] = [k, char]
				else:
					a[1] = [k, char]
	if a[0][0] == a[1][0]:
		if a[0][0] == 0:
			a[0][0] = 1
		else:
			a[0][0] = 0
	elif a[0][1] == a[1][1]:
		if a[0][1] == 0:
			a[0][1] = 1
		else:
			a[0][1] = 0
	d = [a[0][0], a[1][0]]
	e = [a[0][1], a[1][1]]
	for l in range(n):
		g = '.' * n
		if l in d:
			g = list('.' * n)
			g[e[0]] = '*'
			g[e[1]] = '*'
			g = ''.join(g)
		print(g)


for _ in range(int(input())):
	n = int(input())
	l = []
	flag = False
	lst = set()
	list_i = []
	for _ in range(n):
		s = input()
		lst.add(s.find('*'))
		lst.add(s.rfind('*'))
		if s.count('*') == 2:
			list_i.append(s)
			flag = True
		l.append(s)
	if -1 in lst:
		lst.remove(-1)
	lst = list(lst)
	if len(lst) == 1:
		if lst[0] == 0:
			lst.append(1)
		else:
			lst.append(0)
	m = 2
	if flag:
		if l[0].count('*') > 0:
			m = 0
		elif l[-1].count('*') > 0:
			m = 1
		if m == 0:
			print(l[0])
			print(l[0])
			for i in l[2:]:
				print(i)
		elif m == 1:
			for i in l[0:-2]:
				print(i)
			print(l[-1])
			print(l[-1])
		else:
			print(list_i[0])
			for i in l[1:]:
				print(i)
	else:
		for i in l:
			if i.count('*') > 0:
				for j in range(len(i)):
					if j in lst:
						print('*', end='')
					else:
						print('.', end='')
				print()
			else:
				print(i)


for i in range(int(input())):
	a = int(input())
	blanck = []
	pos = []
	for j in range(a):
		lst = list(input())
		for k in range(len(lst)):
			if lst[k] == '*':
				pos.append((j, k))
		blanck.append(lst)
	arr = blanck
	(x, y) = ([], [])
	if pos == []:
		arr[0][0] = '*'
		arr[0][1] = '*'
		arr[1][1] = '*'
		arr[1][0] = '*'
	try:
		if pos:
			for i in pos:
				x.append(i[0])
				y.append(i[1])
			if len(set(x)) == 1:
				if x[0] + 1 < len(arr):
					x.append(x[0] + 1)
				elif x[0] - 1 >= 0:
					x.append(x[0] - 1)
			if len(set(y)) == 1:
				if y[0] + 1 < len(arr):
					y.append(y[0] + 1)
				elif y[0] - 1 >= 0:
					y.append(y[0] - 1)
			for i in x:
				for j in y:
					arr[i][j] = '*'
	except:
		pass
	for i in arr:
		print(''.join(i))


for i in range(int(input())):
	L = []
	n = int(input())
	m = [['.'] * n for i in range(n)]
	x = []
	y = []
	for j in range(n):
		s = input()
		for k in range(len(s)):
			if s[k] == '*':
				m[j][k] = '*'
				x.append(j)
				y.append(k)
	if len(set(x)) == 1:
		if x[0] != 0:
			m[0][y[0]] = '*'
			m[0][y[1]] = '*'
		else:
			m[1][y[0]] = '*'
			m[1][y[1]] = '*'
	elif len(set(y)) == 1:
		if y[0] != 0:
			m[x[0]][0] = '*'
			m[x[1]][0] = '*'
		else:
			m[x[0]][1] = '*'
			m[x[1]][1] = '*'
	else:
		m[x[0]][y[1]] = '*'
		m[x[1]][y[0]] = '*'
	for ll in m:
		print(''.join(ll))


mas = list(map(int, input().split()))
t = mas[0]
for j in range(t):
	mas = list(map(int, input().split()))
	n = mas[0]
	lst = []
	res = []
	for k in range(n):
		mas = list(map(str, input().split()))
		mas = mas[0]
		lst = lst + [list(mas)]
		ind = mas.find('*')
		while ind > -1:
			res = res + [[k, ind]]
			ind = mas.find('*', ind + 1)
	if res[0][0] != res[1][0] and res[0][1] != res[1][1]:
		res = res + [[res[0][0], res[1][1]]] + [[res[1][0], res[0][1]]]
	elif res[0][0] != res[1][0]:
		if res[0][1] == n - 1:
			res = res + [[res[0][0], res[0][1] - 1]] + [[res[1][0], res[0][1] - 1]]
		else:
			res = res + [[res[0][0], res[0][1] + 1]] + [[res[1][0], res[0][1] + 1]]
	elif res[0][1] != res[1][1]:
		if res[0][0] == n - 1:
			res = res + [[res[0][0] - 1, res[0][1]]] + [[res[0][0] - 1, res[1][1]]]
		else:
			res = res + [[res[0][0] + 1, res[0][1]]] + [[res[0][0] + 1, res[1][1]]]
	for k in range(4):
		lst[res[k][0]][res[k][1]] = '*'
	for k in range(n):
		print(''.join(lst[k]))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		l = []
		for i in range(n):
			arr = list(input())
			l.append(arr)
		ans = []
		for i in range(n):
			for j in range(n):
				if l[i][j] == '*':
					ans.append([i, j])
		if ans[0][0] == ans[1][0]:
			if ans[0][0] == 0:
				l[1][ans[0][1]] = '*'
				l[1][ans[1][1]] = '*'
			else:
				l[0][ans[0][1]] = '*'
				l[0][ans[1][1]] = '*'
		elif ans[0][1] == ans[1][1]:
			if ans[0][1] == 0:
				l[ans[0][0]][1] = '*'
				l[ans[1][0]][1] = '*'
			else:
				l[ans[0][0]][0] = '*'
				l[ans[1][0]][0] = '*'
		else:
			l[ans[0][0]][ans[1][1]] = '*'
			l[ans[1][0]][ans[0][1]] = '*'
		for i in range(n):
			for j in range(n):
				print(l[i][j], end='')
			print()
main()


test_case = int(input())
for i in range(test_case):
	n = int(input())
	matrix = []
	for j in range(n):
		matrix.append(list(input()))
	found1 = False
	found2 = False
	for j in range(n):
		if matrix[j].__contains__('*') and found1 == False:
			pos1 = [j, matrix[j].index('*')]
			matrix[pos1[0]][pos1[1]] = '.'
			found1 = True
		if matrix[j].__contains__('*') and found1 == True:
			pos2 = [j, matrix[j].index('*')]
			found2 = True
		if found1 and found2:
			break
	matrix[pos1[0]][pos1[1]] = '*'
	if pos1[0] == pos2[0]:
		if pos2[0] < n - 1:
			pos3 = [pos1[0] + 1, pos1[1]]
			pos4 = [pos2[0] + 1, pos2[1]]
		else:
			pos3 = [pos1[0] - 1, pos1[1]]
			pos4 = [pos2[0] - 1, pos2[1]]
	elif pos1[1] == pos2[1]:
		pos3 = [pos1[0], abs(pos1[1] - 1)]
		pos4 = [pos2[0], abs(pos2[1] - 1)]
	else:
		pos3 = [pos1[0], pos2[1]]
		pos4 = [pos2[0], pos1[1]]
	matrix[pos3[0]][pos3[1]] = '*'
	matrix[pos4[0]][pos4[1]] = '*'
	for j in range(n):
		str = ''
		print(str.join(matrix[j]))


for _ in range(int(input())):
	n = int(input())
	s = []
	for i in range(n):
		s.append(list(input()))
	stars = []
	for i in range(n):
		for j in range(n):
			if s[i][j] == '*':
				stars.append([i, j])
	r1 = stars[0][0]
	r2 = stars[1][0]
	c1 = stars[0][1]
	c2 = stars[1][1]
	if r1 == r2:
		if r1 == n - 1:
			s[r1 - 1][c1] = '*'
			s[r2 - 1][c2] = '*'
		else:
			s[stars[0][0] + 1][c1] = '*'
			s[r2 + 1][c2] = '*'
	elif c1 == c2:
		if c1 == n - 1:
			s[r1][c1 - 1] = '*'
			s[r2][c2 - 1] = '*'
		else:
			s[stars[0][0]][c1 + 1] = '*'
			s[r2][c2 + 1] = '*'
	else:
		s[r1][c2] = '*'
		s[r2][c1] = '*'
	for i in range(n):
		for j in range(n):
			print(s[i][j], end='')
		print()


def gen(lr, i, j):
	lr[i] = lr[i][:j] + '*' + lr[i][j + 1:]

def gen2(lr, i, j1, j2):
	lr[i] = lr[i][:j1] + '*' + lr[i][j1 + 1:j2] + '*' + lr[i][j2 + 1:]
t = int(input())
for x in range(t):
	n = int(input())
	lst = []
	i = []
	j = []
	for k in range(n):
		l = input()
		if '*' in l:
			if l.count('*') == 2:
				sd = -1
				while l[sd] != '*':
					sd -= 1
				j.append(l.index('*'))
				i.append(k)
				j.append(sd + len(l))
				i.append(k)
			else:
				j.append(l.index('*'))
				i.append(k)
		lst.append(l)
	if i[0] == i[1]:
		if i[0] == 0:
			i.append(1)
			i.append(1)
			j.append(j[0])
			j.append(j[1])
		else:
			i.append(i[0] - 1)
			i.append(i[0] - 1)
			j.append(j[0])
			j.append(j[1])
	elif j[0] == j[1]:
		if j[0] == 0:
			j.append(1)
			j.append(1)
			i.append(i[0])
			i.append(i[1])
		else:
			j.append(j[0] - 1)
			j.append(j[0] - 1)
			i.append(i[0])
			i.append(i[1])
	else:
		i.append(i[1])
		i.append(i[0])
		j.append(j[0])
		j.append(j[1])
	if i[-1] != i[-2]:
		for hj in range(2):
			gen(lst, i[hj + 2], j[hj + 2])
	else:
		gen2(lst, i[-1], j[2], j[3])
	for jk in lst:
		print(jk)


test = int(input())
while test > 0:
	n = int(input())
	arr = []
	for i in range(n):
		arr.append(list(input()))
	x = y = 0
	x1 = y1 = 0
	count = 1
	for i in range(n):
		for j in range(n):
			if count == 1 and arr[i][j] == '*':
				x = j
				y = i
				count += 1
			elif count == 2 and arr[i][j] == '*':
				x1 = j
				y1 = i
				break
	if y == y1:
		arr[(y + 1) % n][x1] = '*'
		arr[(y + 1) % n][x] = '*'
	elif x1 == x:
		arr[y1][(x1 + 1) % n] = '*'
		arr[y][(x + 1) % n] = '*'
	else:
		arr[y][x1] = '*'
		arr[y1][x] = '*'
	for s1 in arr:
		s = ''
		for a in s1:
			s += str(a)
		print(s)
	test -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	for i in range(n):
		a.append(list(input()))
	pos = []
	for i in range(n):
		for j in range(n):
			if a[i][j] == '*':
				pos.append([i, j])
	if pos[0][0] != pos[1][0] and pos[0][1] != pos[1][1]:
		a[pos[0][0]][pos[1][1]] = '*'
		a[pos[1][0]][pos[0][1]] = '*'
	elif pos[0][0] == pos[1][0]:
		if pos[0][0] < n - 1:
			a[pos[0][0] + 1][pos[0][1]] = '*'
			a[pos[1][0] + 1][pos[1][1]] = '*'
		else:
			a[pos[0][0] - 1][pos[0][1]] = '*'
			a[pos[1][0] - 1][pos[1][1]] = '*'
	elif pos[0][1] == pos[1][1]:
		if pos[0][1] < n - 1:
			a[pos[0][0]][pos[0][1] + 1] = '*'
			a[pos[1][0]][pos[1][1] + 1] = '*'
		else:
			a[pos[0][0]][pos[0][1] - 1] = '*'
			a[pos[1][0]][pos[1][1] - 1] = '*'
	for i in range(n):
		print(''.join(a[i]))


t = int(input())
while t:
	n = int(input())
	x = set()
	y = set()
	matrix = [list(input()) for _ in range(n)]
	for i in range(n):
		for j in range(n):
			if matrix[i][j] == '*':
				x.add(i)
				y.add(j)
	x = list(x)
	y = list(y)
	if len(x) == 1:
		if x[0] == n - 1:
			x.append(n - 2)
		else:
			x.append(x[0] + 1)
	if len(y) == 1:
		if y[0] == n - 1:
			y.append(n - 2)
		else:
			y.append(y[0] + 1)
	for i in range(len(x)):
		for j in range(len(y)):
			matrix[x[i]][y[j]] = '*'
	for i in range(len(matrix)):
		print(''.join(matrix[i]))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(list(input()))
	col = []
	row = []
	for i in range(n):
		for j in range(n):
			if l[i][j] == '*':
				row.append(i)
				col.append(j)
	ansr = []
	ansc = []
	if row[0] == row[1]:
		if row[0] != n - 1:
			ansr.append(row[0] + 1)
			ansr.append(row[0] + 1)
		else:
			ansr.append(row[0] - 1)
			ansr.append(row[0] - 1)
		ansc = col
	elif col[0] == col[1]:
		if col[0] != n - 1:
			ansc.append(col[0] + 1)
			ansc.append(col[0] + 1)
		else:
			ansc.append(col[0] - 1)
			ansc.append(col[0] - 1)
		ansr = row
	else:
		ansr = [row[0], row[1]]
		ansc = [col[1], col[0]]
	l[ansr[0]][ansc[0]] = '*'
	l[ansr[1]][ansc[1]] = '*'
	for i in l:
		print(''.join(i))


import sys
rd = sys.stdin.readline
t = int(rd())
for _ in range(t):
	n = int(rd())
	a = [list(list(rd().strip())) for _ in range(n)]
	x = set()
	y = set()
	for i in range(n):
		for j in range(n):
			if a[i][j] == '*':
				x.add(i)
				y.add(j)
	if len(x) != 2:
		for i in range(n):
			if i not in x:
				x.add(i)
				break
	if len(y) != 2:
		for j in range(n):
			if j not in y:
				y.add(j)
				break
	for i in x:
		for j in y:
			a[i][j] = '*'
	for i in range(n):
		print(''.join(a[i]))


for q in range(int(input())):
	n = int(input())
	a = list()
	for i in range(n):
		a.append(list(input().strip()))
	(x1, y1, x2, y2) = (0, 0, 0, 0)
	p = True
	for i in range(n):
		for j in range(n):
			if a[i][j] == '*' and p:
				x1 = i
				y1 = j
				p = False
			elif a[i][j] == '*':
				x2 = i
				y2 = j
	if x1 == x2:
		if x1 != n - 1:
			a[x1 + 1][y1] = '*'
			a[x2 + 1][y2] = '*'
		else:
			a[x1 - 1][y1] = '*'
			a[x2 - 1][y2] = '*'
	elif y1 == y2:
		if y1 != n - 1:
			a[x1][y1 + 1] = '*'
			a[x2][y2 + 1] = '*'
		else:
			a[x1][y1 - 1] = '*'
			a[x2][y2 - 1] = '*'
	else:
		a[x1][y2] = '*'
		a[x2][y1] = '*'
	for i in a:
		for j in i:
			print(j, end='')
		print()


t = int(input())
for case in range(t):
	n = int(input())
	lads = []
	for i in range(n):
		lads.append(str(input()))
	x1 = -1
	x2 = -1
	y1 = -1
	y2 = -1
	for i in range(n):
		testst = lads[i]
		if x1 == -1:
			if '*' in testst:
				x1 = testst.index('*')
				y1 = i
				newtest = testst[0:testst.index('*')] + testst[testst.index('*') + 1:]
				if '*' in newtest:
					x2 = newtest.index('*') + 1
					y2 = i
		elif x2 == -1:
			if '*' in testst:
				x2 = testst.index('*')
				y2 = i
	outbox = []
	if x1 == x2:
		if x1 >= 1:
			x2 = 0
		else:
			x2 = x1 + 1
	if y1 == y2:
		if y1 >= 1:
			y2 = 0
		else:
			y2 = y1 + 1
	for i in range(n):
		outstr = ''
		if y1 == i or y2 == i:
			if x1 > x2:
				outstr = '.' * x2 + '*' + '.' * (x1 - x2 - 1) + '*' + '.' * (n - x1 - 1)
			if x2 > x1:
				outstr = '.' * x1 + '*' + '.' * (x2 - x1 - 1) + '*' + '.' * (n - x2 - 1)
		else:
			outstr = '.' * n
		print(outstr)


q = int(input())
for i in range(q):
	w = int(input())
	l = []
	for j in range(w):
		e = input()
		for k in range(w):
			if e[k] == '*':
				l.append([j, k])
	if l[0][0] != l[1][0] and l[0][1] != l[1][1]:
		l.append([l[0][0], l[1][1]])
		l.append([l[1][0], l[0][1]])
	elif l[0][0] == l[1][0] and l[0][1] != l[1][1]:
		if l[0][0] == 0:
			l.append([1, l[0][1]])
			l.append([1, l[1][1]])
		else:
			l.append([0, l[0][1]])
			l.append([0, l[1][1]])
	elif l[0][0] != l[1][0] and l[0][1] == l[1][1]:
		if l[0][1] == 0:
			l.append([l[0][0], 1])
			l.append([l[1][0], 1])
		else:
			l.append([l[0][0], 0])
			l.append([l[1][0], 0])
	for j in range(w):
		if j not in [l[0][0], l[1][0], l[2][0], l[3][0]]:
			print('.' * w)
		else:
			s = '.' * w
			for k in range(4):
				if l[k][0] == j:
					s = s[:l[k][1]] + '*' + s[l[k][1] + 1:]
			print(s)


test_cases = int(input())
for test_case in range(test_cases):
	matrix_size = int(input())
	matrix = []
	for row in range(matrix_size):
		matrix.append(list(input()))
	coordinates = []
	row = 0
	while row < matrix_size:
		column = 0
		while column < matrix_size:
			if matrix[row][column] == '*':
				coordinates.append((row, column))
			if len(coordinates) == 2:
				break
			column += 1
		if len(coordinates) == 2:
			break
		row += 1
	if coordinates[0][0] == coordinates[1][0]:
		if coordinates[0][0] == 0:
			matrix[coordinates[0][0] + 1][coordinates[0][1]] = '*'
			matrix[coordinates[1][0] + 1][coordinates[1][1]] = '*'
		else:
			matrix[coordinates[0][0] - 1][coordinates[0][1]] = '*'
			matrix[coordinates[1][0] - 1][coordinates[1][1]] = '*'
	elif coordinates[0][1] == coordinates[1][1]:
		if coordinates[0][1] == 0:
			matrix[coordinates[0][0]][coordinates[0][1] + 1] = '*'
			matrix[coordinates[1][0]][coordinates[1][1] + 1] = '*'
		else:
			matrix[coordinates[0][0]][coordinates[0][1] - 1] = '*'
			matrix[coordinates[1][0]][coordinates[1][1] - 1] = '*'
	else:
		matrix[coordinates[0][0]][coordinates[1][1]] = '*'
		matrix[coordinates[1][0]][coordinates[0][1]] = '*'
	for row in matrix:
		for column in row:
			print(column, end='')
		print()


def find(li):
	indices = []
	for i in range(0, len(li)):
		for j in range(0, len(li)):
			if li[i][j] == '*':
				indices.append(i)
				indices.append(j)
	x1 = indices[0]
	y1 = indices[1]
	x2 = indices[2]
	y2 = indices[3]
	if x1 != x2 and y1 != y2:
		li[x1][y2] = '*'
		li[x2][y1] = '*'
	elif x1 == x2:
		if x1 == x2 == len(li) - 1:
			li[x1 - 1][y1] = '*'
			li[x2 - 1][y2] = '*'
		else:
			li[x1 + 1][y1] = '*'
			li[x2 + 1][y2] = '*'
	elif y1 == y2:
		if y1 == y2 == len(li) - 1:
			li[x1][y1 - 1] = '*'
			li[x2][y2 - 1] = '*'
		else:
			li[x1][y1 + 1] = '*'
			li[x2][y2 + 1] = '*'
	for i in li:
		print(''.join(i))
n = int(input())
for i in range(0, n):
	l = int(input())
	li = []
	for i in range(0, l):
		x = list(str(input()))
		li.append(x)
	find(li)


def solve():
	n = int(input())
	idx1 = -1
	idy1 = -1
	idx2 = -1
	idy2 = -1
	mark = True
	for i in range(n):
		a = input()
		for j in range(n):
			if a[j] == '*':
				if mark:
					idx1 = j
					idy1 = i
					mark = False
				else:
					idx2 = j
					idy2 = i
	if idx1 == idx2:
		if idx1 == 0:
			for i in range(n):
				for j in range(n):
					if j == idx1 and i == idy1:
						print('*', end='')
					elif j == idx1 + 1 and i == idy1:
						print('*', end='')
					elif j == idx2 and i == idy2:
						print('*', end='')
					elif j == idx2 + 1 and i == idy2:
						print('*', end='')
					else:
						print('.', end='')
				print('')
		else:
			for i in range(n):
				for j in range(n):
					if j == idx1 and i == idy1:
						print('*', end='')
					elif j == idx1 - 1 and i == idy1:
						print('*', end='')
					elif j == idx2 and i == idy2:
						print('*', end='')
					elif j == idx2 - 1 and i == idy2:
						print('*', end='')
					else:
						print('.', end='')
				print('')
		return 0
	if idy1 == idy2:
		if idy1 == 0:
			for i in range(n):
				for j in range(n):
					if j == idx1 and i == idy1:
						print('*', end='')
					elif j == idx1 and i == idy1 + 1:
						print('*', end='')
					elif j == idx2 and i == idy2:
						print('*', end='')
					elif j == idx2 and i == idy2 + 1:
						print('*', end='')
					else:
						print('.', end='')
				print('')
		else:
			for i in range(n):
				for j in range(n):
					if j == idx1 and i == idy1:
						print('*', end='')
					elif j == idx1 and i == idy1 - 1:
						print('*', end='')
					elif j == idx2 and i == idy2:
						print('*', end='')
					elif j == idx2 and i == idy2 - 1:
						print('*', end='')
					else:
						print('.', end='')
				print('')
		return 0
	for i in range(n):
		for j in range(n):
			if j == idx1 and i == idy1:
				print('*', end='')
			elif j == idx2 and i == idy1:
				print('*', end='')
			elif j == idx2 and i == idy2:
				print('*', end='')
			elif j == idx1 and i == idy2:
				print('*', end='')
			else:
				print('.', end='')
		print('')
	return 0
T = int(input())
for i in range(T):
	solve()


t = int(input())
for k in range(t):
	n = int(input())
	q = 0
	(l, x, y) = ([], [], [])
	for i in range(n):
		s = input()
		l.append(s)
		if q < 2:
			for j in range(n):
				if s[j] == '*':
					x.append(i)
					y.append(j)
					q += 1
	(x1, y1) = (x[0], y[0])
	(x2, y2) = (x[1], y[1])
	if y1 != y2 and x1 != x2:
		l[x1] = l[x1][:y2] + '*' + l[x1][y2 + 1:]
		l[x2] = l[x2][:y1] + '*' + l[x2][y1 + 1:]
	elif x1 != x2:
		if y1 != 0:
			l[x1] = '*' + l[x1][1:]
			l[x2] = '*' + l[x2][1:]
		else:
			l[x1] = '**' + l[x1][2:]
			l[x2] = '**' + l[x2][2:]
	elif x1 != 0:
		l[0] = l[x1]
	else:
		l[1] = l[0]
	for i in l:
		print(i)


for _ in range(int(input())):
	n = int(input())
	arr = []
	for _ in range(n):
		s = list(input())
		arr.append(s)
	temp = []
	for i in range(n):
		for j in range(n):
			if arr[i][j] == '*':
				temp.append([i, j])
	(x1, y1) = (temp[0][0], temp[0][1])
	(x2, y2) = (temp[1][0], temp[1][1])
	if x1 == x2:
		if x1 + 1 < n:
			arr[x1 + 1][y1] = '*'
			arr[x2 + 1][y2] = '*'
		elif x1 - 1 >= 0:
			arr[x1 - 1][y1] = '*'
			arr[x2 - 1][y2] = '*'
	elif y1 == y2:
		if y1 + 1 < n:
			arr[x1][y1 + 1] = '*'
			arr[x2][y2 + 1] = '*'
		elif y1 - 1 >= 0:
			arr[x1][y1 - 1] = '*'
			arr[x2][y2 - 1] = '*'
	else:
		arr[x1][y2] = '*'
		arr[x2][y1] = '*'
	for i in range(n):
		print(''.join(arr[i]))


for _ in range(int(input())):
	n = int(input())
	arr = list()
	ind = []
	for i in range(n):
		row = list(input())
		for j in range(n):
			if row[j] == '*':
				ind.append([i, j])
		arr.append(row)
	if ind[0][0] == ind[1][0]:
		if ind[0][0] == n - 1:
			x = -1
		else:
			x = 1
		arr[ind[0][0] + x][ind[0][1]] = '*'
		arr[ind[1][0] + x][ind[1][1]] = '*'
	elif ind[0][1] == ind[1][1]:
		if ind[0][1] == n - 1:
			x = -1
		else:
			x = 1
		arr[ind[0][0]][ind[0][1] + x] = '*'
		arr[ind[1][0]][ind[1][1] + x] = '*'
	elif ind[0][0] == 0 and ind[0][1] == 0 and (ind[1][0] == n - 1) and (ind[1][1] == n - 1):
		arr[ind[0][0]][ind[1][0]] = '*'
		arr[ind[1][0]][ind[0][0]] = '*'
	else:
		index1 = [ind[0][0], ind[1][1]]
		index2 = [ind[1][0], ind[0][1]]
		arr[index1[0]][index1[1]] = '*'
		arr[index2[0]][index2[1]] = '*'
	for i in arr:
		print(''.join(i))


t = int(input())
for _ in range(t):
	n = int(input())
	matrix = []
	cords = []
	for i in range(n):
		matrix.append(list(input()))
		for j in range(len(matrix[-1])):
			if matrix[i][j] == '*':
				cords.append([i, j])
	(x1, y1) = cords[0]
	(x2, y2) = cords[1]
	cords.append(cords[0])
	cords.append(cords[1])
	if x1 == x2:
		cords[2][0] = (cords[2][0] + 1) % n
		cords[3][0] = (cords[3][0] + 1) % n
	elif y1 == y2:
		cords[2][1] = (cords[2][1] + 1) % n
		cords[3][1] = (cords[3][1] + 1) % n
	else:
		(cords[2][0], cords[3][0]) = (cords[3][0], cords[2][0])
	matrix[cords[2][0]][cords[2][1]] = '*'
	matrix[cords[3][0]][cords[3][1]] = '*'
	for i in range(n):
		print(''.join(matrix[i]))


t = int(input())
for t in range(t):
	p = int(input())
	lst = []
	q = 0
	x1 = -1
	y1 = -1
	x2 = -1
	y2 = -1
	x = 0
	for i in range(p):
		lst1 = list(input())
		lst.append(lst1)
		if q == 1:
			if x2 == 0:
				lst[x1 + 1][y2] = '*'
				lst[x1 + 1][y1] = '*'
			q += 1
		for j in range(len(lst1)):
			if lst1[j] == '*':
				if x1 < 0:
					x1 = i
					y1 = j
				else:
					x2 = i
					y2 = j
		if x2 >= 0 and q == 0:
			if x1 == x2:
				if x1 == 0:
					q = 1
				else:
					lst[x1 - 1][y2] = '*'
					lst[x1 - 1][y1] = '*'
			elif lst[x1][y2] == '*':
				if y1 == 0:
					lst[x1][y1 + 1] = '*'
					lst[x2][y2 + 1] = '*'
				else:
					lst[x1][y1 - 1] = '*'
					lst[x2][y2 - 1] = '*'
			else:
				lst[x1][y2] = '*'
				lst[x2][y1] = '*'
			q = 1
	for i in lst:
		for j in i:
			print(j, end='')
		print()


import sys
import typing

def rl(proc=None) -> typing.Any:
	if proc is not None:
		return proc(sys.stdin.readline())
	else:
		return sys.stdin.readline().rstrip()

def srl(proc=None) -> typing.List[typing.Any]:
	if proc is not None:
		return list(map(proc, rl().split()))
	else:
		return rl().split()

def main():
	T = rl(int)
	for t in range(1, T + 1):
		n = rl(int)
		A = [list(rl()) for _ in range(n)]
		pos = []
		for i in range(n):
			for j in range(n):
				if A[i][j] == '*':
					pos.append((i, j))
		(x1, y1) = pos[0]
		(x2, y2) = pos[1]
		if x1 == x2:
			x = x1 - 1
			if x < 0:
				x += 2
			A[x][y1] = '*'
			A[x][y2] = '*'
		elif y1 == y2:
			y = y1 - 1
			if y < 0:
				y += 2
			A[x1][y] = '*'
			A[x2][y] = '*'
		else:
			A[x1][y2] = '*'
			A[x2][y1] = '*'
		for row in A:
			print(''.join(row))
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	s = []
	for i in range(n):
		l = list(map(str, input().split()))
		d = list(l[0])
		a.append(d)
	for i in range(n):
		for j in range(n):
			if a[i][j] == '*':
				s.append([i, j])
	if s[0][0] == s[1][0]:
		if s[0][0] != 0:
			a[s[0][0] - 1][s[0][1]] = '*'
			a[s[1][0] - 1][s[1][1]] = '*'
		else:
			a[s[0][0] + 1][s[0][1]] = '*'
			a[s[1][0] + 1][s[1][1]] = '*'
	elif s[0][1] == s[1][1]:
		if s[0][1] == 0:
			a[s[0][0]][s[0][1] + 1] = '*'
			a[s[1][0]][s[1][1] + 1] = '*'
		else:
			a[s[0][0]][s[0][1] - 1] = '*'
			a[s[1][0]][s[1][1] - 1] = '*'
	else:
		a[s[0][0]][s[1][1]] = '*'
		a[s[1][0]][s[0][1]] = '*'
	for i in a:
		for j in i:
			print(j, end='')
		print()


def zamien(wiersz):
	lista = []
	for i in range(len(wiersz)):
		if wiersz[i] == '*':
			lista.append(1)
		else:
			lista.append(0)
	return lista

def znajdz(lista):
	n = len(lista)
	wynik = []
	for i in range(n):
		for x in range(n):
			if lista[i][x] == 1:
				wynik.append([i, x])
	return wynik

def kwadrat(x, y, lista):
	if x[0] != y[0] and x[1] != y[1]:
		lista[x[0]][y[1]] = 1
		lista[y[0]][x[1]] = 1
	elif x[0] == y[0]:
		if x[0] != 0:
			lista[y[0] - 1][x[1]] = 1
			lista[x[0] - 1][y[1]] = 1
		else:
			lista[y[0] + 1][x[1]] = 1
			lista[x[0] + 1][y[1]] = 1
	elif x[1] != 0:
		lista[y[0]][x[1] - 1] = 1
		lista[x[0]][y[1] - 1] = 1
	else:
		lista[y[0]][x[1] + 1] = 1
		lista[x[0]][y[1] + 1] = 1
	return lista

def napraw(lista):
	wynik = []
	n = len(lista)
	for i in range(n):
		for x in range(n):
			if lista[i][x] == 0:
				print('.', end='')
			else:
				print('*', end='')
		print('')
n = int(input())
for i in range(n):
	k = int(input())
	lista = []
	for x in range(k):
		wiersz = input()
		wiersz.join(' ')
		wiersz.split()
		lista.append(zamien(wiersz))
	poz = znajdz(lista)
	lista = kwadrat(poz[0], poz[1], lista)
	napraw(lista)


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def ceildiv(x, y):
	return (x + y - 1) // y

def di():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
t = int(input())
while t:
	t -= 1
	n = int(input())
	l = [list(map(str, input())) for i in range(n)]
	ans = []
	for i in range(n):
		for j in range(n):
			if l[i][j] == '*':
				ans.append([i, j])
	r1 = ans[0][0]
	c1 = ans[0][1]
	r2 = ans[1][0]
	c2 = ans[1][1]
	print
	if r1 == r2:
		if r1 != n - 1:
			l[r1 + 1][c1] = l[r1 + 1][c2] = '*'
		else:
			l[r1 - 1][c1] = l[r1 - 1][c2] = '*'
	elif c1 == c2:
		if c1 != n - 1:
			l[r1][c1 + 1] = l[r2][c2 + 1] = '*'
		else:
			l[r1][c1 - 1] = l[r2][c2 - 1] = '*'
	else:
		l[r1][c2] = l[r2][c1] = '*'
	for i in range(n):
		for j in range(n):
			print(l[i][j], end='')
		print(end='\n')


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	arr = []
	for i in range(n):
		s = input()
		arr.append(s)
		if '*' in s and s.count('*') == 1:
			l.append([i, s.index('*'), s])
		elif '*' in s and s.count('*') == 2:
			l.append([i, s])
	if len(l) == 2:
		if l[0][1] != l[1][1]:
			new = ''
			for (x, y) in zip(l[0][2], l[1][2]):
				if x != y:
					new = new + '*'
				else:
					new = new + '.'
		else:
			new = ''
			c = 1
			for (x, y) in zip(l[0][2], l[1][2]):
				if x == y == '.' and c:
					new = new + '*'
					c = 0
				elif x == y == '*':
					new = new + '*'
				else:
					new = new + '.'
		arr[l[0][0]] = new
		arr[l[1][0]] = new
		for i in arr:
			print(i)
	else:
		c = 1
		for i in arr:
			if i != l[0][1] and c:
				print(l[0][1])
				c = 0
			else:
				print(i)


t = int(input())
for i in range(t):
	l = int(input())
	matrix = []
	p = []
	for i in range(l):
		x = list(str(input()))
		matrix.append(x)
		for j in range(l):
			if matrix[i][j] == '*':
				p.append((i, j))
	(r1, c1) = (p[0][0], p[0][1])
	(r2, c2) = (p[1][0], p[1][1])
	if c1 == c2:
		if c1 == 0:
			matrix[r1][1] = '*'
			matrix[r2][1] = '*'
		else:
			matrix[r1][0] = '*'
			matrix[r2][0] = '*'
	elif r1 == r2:
		if r1 == 0:
			matrix[1][c1] = '*'
			matrix[1][c2] = '*'
		else:
			matrix[0][c1] = '*'
			matrix[0][c2] = '*'
	else:
		matrix[r1][c2] = '*'
		matrix[r2][c1] = '*'
	for i in range(l):
		print(''.join(matrix[i]))


for _ in range(int(input())):
	n = int(input())
	f = []
	for __ in range(n):
		f1 = list(input())
		f.append(f1)
	(r1, c1, r2, c2) = (0, 0, 0, 0)
	for i in range(n):
		for j in range(n):
			if f[i][j] == '*':
				if r1 == 0:
					r1 = i + 1
					c1 = j + 1
				else:
					r2 = i + 1
					c2 = j + 1
					break
	if r1 == r2:
		if r1 == n:
			f[r1 - 2][c1 - 1] = '*'
			f[r2 - 2][c2 - 1] = '*'
		else:
			f[r1][c1 - 1] = '*'
			f[r2][c2 - 1] = '*'
	elif c1 == c2:
		if c1 == n:
			f[r1 - 1][c1 - 2] = '*'
			f[r2 - 1][c2 - 2] = '*'
		else:
			f[r1 - 1][c1] = '*'
			f[r2 - 1][c2] = '*'
	elif c1 > c2:
		f[r1 - 1][c2 - 1] = '*'
		f[r2 - 1][c1 - 1] = '*'
	else:
		f[r1 - 1][c2 - 1] = '*'
		f[r2 - 1][c1 - 1] = '*'
	for i in f:
		for j in i:
			print(j, end='')
		print()


from collections import *
TT = int(input())
for y in range(TT):
	n = int(input())
	lst = []
	arr = []
	for i in range(n):
		lst.append(list(input()))
		for j in range(n):
			if lst[i][j] == '*':
				arr.append([i, j])
	a = arr[0][0]
	b = arr[0][1]
	c = arr[1][0]
	d = arr[1][1]
	lst[a][b] = '*'
	lst[a][d] = '*'
	lst[c][b] = '*'
	lst[c][d] = '*'
	if a == c:
		if a == 0:
			c = 1
			lst[a][b] = '*'
			lst[a][d] = '*'
			lst[c][b] = '*'
			lst[c][d] = '*'
		else:
			c = 0
			lst[a][b] = '*'
			lst[a][d] = '*'
			lst[c][b] = '*'
			lst[c][d] = '*'
	if b == d:
		if b == 0:
			d = 1
			lst[a][b] = '*'
			lst[a][d] = '*'
			lst[c][b] = '*'
			lst[c][d] = '*'
		else:
			d = 0
			lst[a][b] = '*'
			lst[a][d] = '*'
			lst[c][b] = '*'
			lst[c][d] = '*'
	for i in lst:
		print(''.join(i))


results = []
for i in range(int(input())):
	n = int(input())
	matrix = []
	c = []
	row = []
	for j in range(n):
		row = input()
		matrix.append(list(row))
	rect_length = 0
	c = [[e, f] for e in range(n) for f in range(n) if matrix[e][f] == '*']
	(x1, y1, x2, y2) = (c[0][0], c[0][1], c[1][0], c[1][1])
	if c[0][::-1] == c[1] or (x1 == y1 and x2 == y2) or (x1 != x2 and y1 != y2):
		matrix[x1][y2] = '*'
		matrix[x2][y1] = '*'
	elif x1 == x2:
		x3 = x1 + 1 if x1 == 0 else x1 - 1
		matrix[x3][y1] = '*'
		matrix[x3][y2] = '*'
	elif y1 == y2:
		y3 = y1 + 1 if y1 == 0 else y1 - 1
		matrix[x1][y3] = '*'
		matrix[x2][y3] = '*'
	results.append(matrix)
for m in results:
	for ro in m:
		print(''.join(ro))


from sys import stdin, stdout
from os import path
rd = lambda : stdin.readline().strip()
wr = stdout.write
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
import time, math
for _ in range(int(rd())):
	x = int(rd())
	arr = []
	mylist = []
	for i in range(x):
		y = rd()
		index = y.find('*')
		mylist.append(y)
		if index == -1:
			continue
		else:
			if '*' in y[index + 1:]:
				z = y.rfind('*')
				arr.append((i, z))
			arr.append((i, index))
	arr.sort()
	out = []
	if arr[0][0] == arr[1][0]:
		if arr[0][0] == x - 1:
			out.append((arr[0][0] - 1, arr[0][1]))
			out.append((arr[0][0] - 1, arr[1][1]))
		else:
			out.append((arr[0][0] + 1, arr[0][1]))
			out.append((arr[0][0] + 1, arr[1][1]))
	elif arr[0][1] == arr[1][1]:
		if arr[0][1] == x - 1:
			out.append((arr[0][0], arr[0][1] - 1))
			out.append((arr[1][0], arr[1][1] - 1))
		else:
			out.append((arr[0][0], arr[0][1] + 1))
			out.append((arr[1][0], arr[1][1] + 1))
	else:
		out.append((arr[0][0], arr[1][1]))
		out.append((arr[1][0], arr[0][1]))
	mylist[out[0][0]] = mylist[out[0][0]][:out[0][1]] + '*' + mylist[out[0][0]][out[0][1] + 1:]
	mylist[out[1][0]] = mylist[out[1][0]][:out[1][1]] + '*' + mylist[out[1][0]][out[1][1] + 1:]
	for i in range(x):
		print(mylist[i])


t = int(input())
for z in range(t):
	n = int(input())
	a = []
	for i in range(n):
		b = list(input())
		if b[len(b) - 1] == '\r':
			b.pop()
		a.append(b)
	d = []
	for i in range(len(a)):
		for j in range(len(a[i])):
			if a[i][j] == '*':
				d.append([i, j])
	if d[0][0] == d[1][0]:
		if d[0][0] < len(a) - 1:
			a[d[0][0] + 1][d[0][1]] = '*'
			a[d[1][0] + 1][d[1][1]] = '*'
		else:
			a[d[0][0] - 1][d[0][1]] = '*'
			a[d[1][0] - 1][d[1][1]] = '*'
	else:
		p = d[0][1] - d[1][1]
		if p == 0:
			if d[0][1] < len(a) - 1:
				a[d[0][0]][d[0][1] + 1] = '*'
				a[d[1][0]][d[1][1] + 1] = '*'
			else:
				a[d[0][0]][d[0][1] - 1] = '*'
				a[d[1][0]][d[1][1] - 1] = '*'
		else:
			a[d[0][0]][d[1][1]] = '*'
			a[d[1][0]][d[0][1]] = '*'
	for i in range(len(a)):
		for j in range(len(a[i])):
			print(a[i][j], end='')
		print()


for i in range(int(input())):
	ind = []
	l = []
	n = int(input())
	for j in range(n):
		l.append([*input()])
	i1 = 0
	i2 = 0
	for a in range(len(l)):
		for b in range(len(l)):
			if l[a][b] == '*':
				ind.append(a)
				ind.append(b)
	if ind[1] != ind[3] and ind[0] != ind[2]:
		l[ind[0]][ind[3]] = '*'
		l[ind[2]][ind[1]] = '*'
	elif ind[1] == ind[3]:
		if ind[1] != n - 1:
			l[ind[0]][ind[3] + 1] = '*'
			l[ind[2]][ind[1] + 1] = '*'
		else:
			l[ind[0]][ind[3] - 1] = '*'
			l[ind[2]][ind[1] - 1] = '*'
	elif ind[0] == ind[2]:
		if ind[0] != n - 1:
			l[ind[0] + 1][ind[3]] = '*'
			l[ind[2] + 1][ind[1]] = '*'
		else:
			l[ind[0] - 1][ind[3]] = '*'
			l[ind[2] - 1][ind[1]] = '*'
	for _ in l:
		print(''.join(_))


for _ in range(int(input())):
	n = int(input())
	starts = []
	arr = []
	for i in range(n):
		arr.append(input().strip())
		if '*' in arr[-1]:
			if arr[-1].count('*') == 1:
				starts.append((i, arr[-1].index('*')))
			elif arr[-1].count('*') == 2:
				starts.append((i, arr[-1].index('*')))
				starts.append((i, n - 1 - arr[-1][::-1].index('*')))
	if starts[0][0] == starts[1][0]:
		x = starts[0][0]
		if x < n - 1:
			arr[x + 1] = arr[x]
		else:
			arr[x - 1] = arr[x]
	elif starts[0][1] == starts[1][1]:
		x = starts[0][1]
		if x != 0:
			arr[starts[0][0]] = '*' + arr[starts[0][0]][1:]
			arr[starts[1][0]] = '*' + arr[starts[1][0]][1:]
		else:
			arr[starts[0][0]] = '**' + arr[starts[0][0]][2:]
			arr[starts[1][0]] = '**' + arr[starts[1][0]][2:]
	else:
		res = ''
		for i in range(n):
			if arr[starts[0][0]][i] == '*' or arr[starts[1][0]][i] == '*':
				res = res + '*'
			else:
				res = res + '.'
		arr[starts[0][0]] = res
		arr[starts[1][0]] = res
	print(*arr, sep='\n')


for i in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		a = list(input())
		l.append(a)
	count = 0
	for i in range(n):
		for j in range(n):
			if l[i][j] == '*':
				count += 1
				if count == 1:
					a = i
					b = j
				else:
					c = i
					d = j
	if a == c:
		if a != n - 1:
			l[a + 1][b] = '*'
			l[c + 1][d] = '*'
		else:
			l[a - 1][b] = '*'
			l[c - 1][d] = '*'
	elif b == d:
		if b != n - 1:
			l[a][b + 1] = '*'
			l[c][d + 1] = '*'
		else:
			l[a][b - 1] = '*'
			l[c][d - 1] = '*'
	else:
		l[c][b] = '*'
		l[a][d] = '*'
	for i in l:
		for j in i:
			print(j, end='')
		print('')


import sys
import math
from collections import Counter, defaultdict
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()

def case():
	n = IN()
	a = []
	b = []
	for i in range(n):
		s = list(S())
		for j in range(n):
			if s[j] == '*':
				b.append((i, j))
		a += [s]
	if b[0][0] == b[1][0]:
		if b[0][0] == n - 1:
			a[b[0][0] - 1][b[0][1]] = '*'
			a[b[1][0] - 1][b[1][1]] = '*'
		else:
			a[b[0][0] + 1][b[0][1]] = '*'
			a[b[1][0] + 1][b[1][1]] = '*'
	elif b[0][1] == b[1][1]:
		if b[0][1] == n - 1:
			a[b[0][0]][b[0][1] - 1] = '*'
			a[b[1][0]][b[1][1] - 1] = '*'
		else:
			a[b[0][0]][b[0][1] + 1] = '*'
			a[b[1][0]][b[1][1] + 1] = '*'
	else:
		a[b[0][0]][b[1][1]] = '*'
		a[b[1][0]][b[0][1]] = '*'
	for i in a:
		print(*i, sep='')
for _ in range(IN()):
	case()


import sys
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def minmax(a, b):
	return (a, b) if a < b else (b, a)
for _ in range(ii()):
	n = ii()
	m = []
	d = []
	for i in range(n):
		tmp = []
		for (j, p) in enumerate(input()):
			tmp.append(p)
			if p == '*':
				d.append((i, j))
		m.append(tmp)
	(a, b) = (d[0], d[1])
	if a[0] == b[0]:
		m[(a[0] + 1) % n][a[1]] = '*'
		m[(b[0] + 1) % n][b[1]] = '*'
	elif a[1] == b[1]:
		m[a[0]][(a[1] + 1) % n] = '*'
		m[b[0]][(b[1] + 1) % n] = '*'
	else:
		m[b[0]][a[1]] = '*'
		m[a[0]][b[1]] = '*'
	for i in range(n):
		print(*m[i], sep='')


t = int(input())
for _ in range(t):
	n = int(input())
	first_corner = None
	second_corner = None
	field = []
	for i in range(n):
		line = input()
		field.append(line)
		if '*' in line and (not first_corner):
			first_corner = [i, line.index('*')]
			if first_corner[1] != n - 1 and '*' in line[first_corner[1] + 1:]:
				second_corner = [i, line.index('*', first_corner[1] + 1)]
		elif '*' in line:
			second_corner = [i, line.index('*')]
	third_corner = []
	fourth_corner = []
	if first_corner[0] == second_corner[0]:
		if first_corner[0] == 0:
			third_corner = [1, first_corner[1]]
			fourth_corner = [1, second_corner[1]]
		else:
			third_corner = [first_corner[0] - 1, first_corner[1]]
			fourth_corner = [second_corner[0] - 1, second_corner[1]]
	elif first_corner[1] == second_corner[1]:
		if first_corner[1] == 0:
			third_corner = [first_corner[0], 1]
			fourth_corner = [second_corner[0], 1]
		else:
			third_corner = [first_corner[0], first_corner[1] - 1]
			fourth_corner = [second_corner[0], second_corner[1] - 1]
	else:
		third_corner = [first_corner[0], second_corner[1]]
		fourth_corner = [second_corner[0], first_corner[1]]
	third_corner_line = field[third_corner[0]]
	field[third_corner[0]] = third_corner_line[:third_corner[1]] + '*' + third_corner_line[third_corner[1] + 1:]
	fourth_corner_line = field[fourth_corner[0]]
	field[fourth_corner[0]] = fourth_corner_line[:fourth_corner[1]] + '*' + fourth_corner_line[fourth_corner[1] + 1:]
	for line in field:
		print(line)


from sys import *
from collections import defaultdict as dd
from math import *
from bisect import *

def sinp():
	return input()

def inp():
	return int(sinp())

def minp():
	return map(int, sinp().split())

def linp():
	return list(minp())

def strl():
	return list(sinp())

def pr(x):
	print(x)
mod = int(1000000000.0 + 7)
for _ in range(inp()):
	n = inp()
	mat = []
	for i in range(n):
		mat.append(list(input()))
	pos = []
	for i in range(n):
		for j in range(n):
			if mat[i][j] == '*':
				pos.append([i, j])
	if pos[0][0] == pos[1][0]:
		if pos[0][0] < n - 1:
			mat[pos[0][0] + 1][pos[0][1]] = '*'
			mat[pos[1][0] + 1][pos[1][1]] = '*'
		else:
			mat[pos[0][0] - 1][pos[0][1]] = '*'
			mat[pos[1][0] - 1][pos[1][1]] = '*'
	elif pos[0][1] == pos[1][1]:
		if pos[0][1] < n - 1:
			mat[pos[0][0]][pos[0][1] + 1] = '*'
			mat[pos[1][0]][pos[1][1] + 1] = '*'
		else:
			mat[pos[0][0]][pos[0][1] - 1] = '*'
			mat[pos[1][0]][pos[1][1] - 1] = '*'
	else:
		x = abs(pos[1][0] - pos[0][0])
		y = abs(pos[0][1] - pos[1][1])
		if pos[0][1] < pos[1][1]:
			mat[pos[0][0]][pos[0][1] + y] = '*'
			mat[pos[1][0]][pos[1][1] - y] = '*'
		else:
			mat[pos[0][0]][pos[0][1] - y] = '*'
			mat[pos[1][0]][pos[1][1] + y] = '*'
	for i in range(n):
		print(''.join(mat[i]))


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	a = [list(input().strip()) for i in range(n)]
	mx = int(1000000000.0)
	Mx = -1
	my = int(1000000000.0)
	My = -1
	for i in range(n):
		for j in range(n):
			if a[i][j] == '*':
				mx = min(mx, i)
				Mx = max(Mx, i)
				my = min(my, j)
				My = max(My, j)
	if mx == Mx:
		if mx > 0:
			mx -= 1
		else:
			Mx += 1
	if my == My:
		if my > 0:
			my -= 1
		else:
			My += 1
	a[mx][my] = '*'
	a[mx][My] = '*'
	a[Mx][my] = '*'
	a[Mx][My] = '*'
	for i in a:
		print(''.join(i))
for i in range(int(input())):
	solve()


test = int(input())
for i in range(test):
	rage = int(input())
	arr = []
	for j in range(rage):
		r = list(input())
		arr.append(r)
	ast = []
	for s in range(rage):
		for k in range(rage):
			if arr[s][k] == '*':
				ast.append((s, k))
	f_p = ast[0]
	s_p = ast[1]
	if f_p[0] == s_p[0]:
		if s_p[0] == rage - 1:
			arr[f_p[0] - 1][f_p[1]] = '*'
			arr[s_p[0] - 1][s_p[1]] = '*'
		else:
			arr[f_p[0] + 1][f_p[1]] = '*'
			arr[s_p[0] + 1][s_p[1]] = '*'
	elif f_p[1] == s_p[1]:
		if f_p[1] == rage - 1:
			arr[f_p[0]][f_p[1] - 1] = '*'
			arr[s_p[0]][s_p[1] - 1] = '*'
		else:
			arr[f_p[0]][f_p[1] + 1] = '*'
			arr[s_p[0]][s_p[1] + 1] = '*'
	else:
		x_dif = f_p[1] - s_p[1]
		arr[f_p[0]][f_p[1] - x_dif] = '*'
		arr[s_p[0]][s_p[1] + x_dif] = '*'
	for g in range(rage):
		arr[g] = ''.join(arr[g])
		print(arr[g])


test_cases = int(input())
rectangles = []
for test_case in range(test_cases):
	n = int(input())
	rows = []
	for _ in range(n):
		rows.append(input())
	rectangles.append(rows)
for rows in rectangles:
	star1 = None
	star2 = None
	for (i, row) in enumerate(rows):
		if row.count('*'):
			if not star1:
				star1 = (row.find('*'), i)
			else:
				star2 = (row.find('*'), i)
		if row.count('*') == 2:
			star2 = (row.rfind('*'), i)
	if star1[0] == star2[0]:
		x_coord = 0 if star1[0] != 0 else 1
		new_star1 = (x_coord, star1[1])
		new_star2 = (x_coord, star2[1])
	elif star1[1] == star2[1]:
		y_coord = 0 if star1[1] != 0 else 1
		new_star1 = (star1[0], y_coord)
		new_star2 = (star2[0], y_coord)
	else:
		new_star1 = (star2[0], star1[1])
		new_star2 = (star1[0], star2[1])
	for (i, row) in enumerate(rows):
		if new_star1[1] == i:
			x = new_star1[0]
			row = row[:x] + '*' + row[x + 1:]
		if new_star2[1] == i:
			x = new_star2[0]
			row = row[:x] + '*' + row[x + 1:]
		print(row)


num = int(input())
for i in range(num):
	n = int(input())
	arr = []
	row = []
	column = []
	for j in range(n):
		text = input()
		text = list(text)
		if '*' in text:
			for z in range(n):
				if text[z] == '*':
					row.append(j)
					column.append(z)
		arr.append(text)
	if row[0] == row[1]:
		if row[0] > 0:
			row[0] -= 1
			row[1] -= 1
		elif row[0] < n - 1:
			row[0] += 1
			row[1] += 1
	elif column[0] == column[1]:
		if column[0] > 0:
			column[0] -= 1
			column[1] -= 1
		elif column[0] < n - 1:
			column[0] += 1
			column[1] += 1
	else:
		temp = row[0]
		row[0] = row[1]
		row[1] = temp
	arr[row[0]][column[0]] = '*'
	arr[row[1]][column[1]] = '*'
	for k in range(n):
		print(''.join(arr[k]))


T = int(input())
for _ in range(T):
	N = int(input())
	G = []
	for i in range(N):
		G.append(list(input()))
	can = []
	(X, Y) = (set(), set())
	for i in range(N):
		for j in range(N):
			if G[i][j] == '*':
				can.append((i, j))
				X.add(i)
				Y.add(j)
	if len(X) == 2 and len(Y) == 2:
		G[min(X)][max(Y)] = '*'
		G[max(X)][min(Y)] = '*'
		G[min(X)][min(Y)] = '*'
		G[max(X)][max(Y)] = '*'
	elif len(X) == 1:
		for next_x in range(N):
			if next_x not in X:
				G[next_x][max(Y)] = '*'
				G[next_x][min(Y)] = '*'
				break
	else:
		for next_y in range(N):
			if next_y not in Y:
				G[min(X)][next_y] = '*'
				G[max(X)][next_y] = '*'
				break
	for i in range(N):
		print(''.join(G[i]))


t = int(input())
for z in range(t):
	n = int(input())
	l = []
	(a, b, c, d) = (-1, -1, -1, -1)
	k = 0
	for i in range(n):
		s = input()
		l.append(list(s))
	for i in range(n):
		for j in range(n):
			if l[i][j] == '*':
				if a == -1 and b == -1:
					a = i
					b = j
				else:
					c = i
					d = j
	if a == c:
		if a + 1 < n:
			l[a + 1][b] = '*'
			l[c + 1][d] = '*'
		else:
			l[a - 1][b] = '*'
			l[c - 1][d] = '*'
	elif b == d:
		if b + 1 < n:
			l[a][b + 1] = '*'
			l[c][d + 1] = '*'
		else:
			l[a][b - 1] = '*'
			l[c][d - 1] = '*'
	else:
		l[c][b] = '*'
		l[a][d] = '*'
	for r in l:
		print(''.join((k for k in r)))


for _ in range(int(input())):
	n = int(input())
	matrix = [list(input()) for _ in range(n)]
	(x1, y1, x2, y2) = (-1, 0, 0, 0)
	for row in range(n):
		s = matrix[row]
		if s.count('*') == 1:
			if x1 == -1:
				x1 = s.index('*')
				y1 = row
			else:
				x2 = s.index('*')
				y2 = row
				break
		elif s.count('*') == 2:
			x1 = s.index('*')
			y1 = row
			s[x1] = '.'
			x2 = s.index('*')
			y2 = row
			s[x1] = '*'
			break
	if x1 != x2 and y1 != y2:
		matrix[y1][x2] = '*'
		matrix[y2][x1] = '*'
	elif x1 != x2 and y1 == y2:
		if y1 - 1 >= 0:
			matrix[y1 - 1][x1] = '*'
			matrix[y1 - 1][x2] = '*'
		else:
			matrix[y1 + 1][x1] = '*'
			matrix[y1 + 1][x2] = '*'
	elif x1 - 1 >= 0:
		matrix[y1][x1 - 1] = '*'
		matrix[y2][x1 - 1] = '*'
	else:
		matrix[y1][x1 + 1] = '*'
		matrix[y2][x1 + 1] = '*'
	for row in matrix:
		print(''.join(row))


for _ in range(int(input())):
	n = int(input())
	arr = []
	for x in range(n):
		s = list(input())
		arr.append(s)
	req = []
	for x in range(len(arr)):
		for y in range(len(arr[0])):
			if arr[x][y] == '*':
				req.append((x, y))
	if req[0][0] != req[1][0] and req[0][1] != req[1][1]:
		arr[req[0][0]][req[1][1]] = '*'
		arr[req[1][0]][req[0][1]] = '*'
	elif req[0][0] == req[1][0]:
		if req[0][0] < n - 1:
			arr[req[0][0] + 1][req[0][1]] = '*'
			arr[req[1][0] + 1][req[1][1]] = '*'
		else:
			arr[req[0][0] - 1][req[0][1]] = '*'
			arr[req[1][0] - 1][req[1][1]] = '*'
	elif req[0][1] == req[1][1]:
		if req[0][1] < n - 1:
			arr[req[0][0]][req[0][1] + 1] = '*'
			arr[req[1][0]][req[1][1] + 1] = '*'
		else:
			arr[req[0][0]][req[0][1] - 1] = '*'
			arr[req[1][0]][req[1][1] - 1] = '*'
	for i in range(n):
		print(''.join(arr[i]))


T = int(input())
for _ in range(T):
	N = int(input())
	grid = [[*input()] for _ in range(N)]
	stars = [(x, y) for x in range(N) for y in range(N) if grid[x][y] == '*']
	if stars[0][0] == stars[1][0]:
		if stars[0][0] == 0:
			x = 1
		else:
			x = stars[0][0] - 1
		grid[x][stars[0][1]] = '*'
		grid[x][stars[1][1]] = '*'
	elif stars[0][1] == stars[1][1]:
		if stars[0][1] == 0:
			y = 1
		else:
			y = stars[0][1] - 1
		grid[stars[0][0]][y] = '*'
		grid[stars[1][0]][y] = '*'
	else:
		grid[stars[1][0]][stars[0][1]] = '*'
		grid[stars[0][0]][stars[1][1]] = '*'
	for row in grid:
		print(*row, sep='')


t = int(input())
for _ in range(t):
	n = int(input())
	array = []
	x = []
	y = []
	for i in range(0, n):
		arr = list(input())
		array.append(arr)
		if arr.count('*') == 1:
			x.append(arr.index('*') + 1)
			y.append(i + 1)
		elif arr.count('*') == 2:
			for j in range(0, n):
				if arr[j] == '*':
					x.append(j + 1)
					y.append(i + 1)
	if len(list(set(x))) > 1 and len(list(set(y))) > 1:
		array[y[1] - 1][x[0] - 1] = '*'
		array[y[0] - 1][x[1] - 1] = '*'
	elif len(list(set(x))) > 1:
		if y[0] < n:
			array[y[1]][x[0] - 1] = '*'
			array[y[0]][x[1] - 1] = '*'
		else:
			array[y[1] - 2][x[0] - 1] = '*'
			array[y[0] - 2][x[1] - 1] = '*'
	elif x[0] < n:
		array[y[1] - 1][x[0]] = '*'
		array[y[0] - 1][x[1]] = '*'
	else:
		array[y[1] - 1][x[0] - 2] = '*'
		array[y[0] - 1][x[1] - 2] = '*'
	for i in array:
		print(''.join(i))


a = eval(input())
for _ in range(a):
	b = eval(input())
	ls = []
	for i in range(b):
		c = input()
		for j in range(len(c)):
			if c[j] == '*':
				ls.append([i, j])
	y1 = ls[0][0]
	x1 = ls[0][1]
	y2 = ls[1][0]
	x2 = ls[1][1]
	x = []
	y = []
	if y1 == y2:
		x.append(x1)
		x.append(x2)
		if y1 + 1 < b:
			y.append(y1)
			y.append(y1 + 1)
		else:
			y.append(y1)
			y.append(y1 - 1)
	elif x1 == x2:
		y.append(y1)
		y.append(y2)
		if x1 + 1 < b:
			x.append(x1 + 1)
			x.append(x1)
		else:
			x.append(x1 - 1)
			x.append(x1)
	else:
		x.append(x1)
		x.append(x2)
		y.append(y1)
		y.append(y2)
	for i in range(b):
		l = ['.' for k in range(b)]
		if i in y:
			l[x[0]] = '*'
			l[x[1]] = '*'
		print(''.join(l))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for i in range(n):
		x = list(input())
		arr.append(x)
	row1 = -1
	row2 = -1
	col1 = -1
	col2 = -1
	c = 0
	for i in range(len(arr)):
		for j in range(len(arr)):
			if arr[i][j] == '*':
				if row1 == -1 and col1 == -1:
					row1 = i
					col1 = j
				else:
					row2 = i
					col2 = j
					c = 1
					break
		if c == 1:
			break
	if col1 == col2:
		if col1 == 0:
			col1 += 1
			col2 += 1
		else:
			col1 -= 1
			col2 -= 1
	if row1 == row2:
		if row1 == 0:
			row1 += 1
			row2 += 1
		else:
			row2 -= 1
			row1 -= 1
	arr[row1][col2] = '*'
	arr[row2][col1] = '*'
	for i in arr:
		print(''.join(i))


from io import BytesIO, IOBase
import sys
import math
import os
from collections import defaultdict
from math import ceil
from bisect import bisect_left, bisect_left
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def mint():
	return map(int, input().split())

def mfloat():
	return map(float, input().split())

def solve():
	points = []
	n = int(input())
	for i in range(n):
		s = input()
		for j in range(n):
			if s[j] == '*':
				points.append([i, j])
	x = [points[0][0], points[1][0]]
	y = [points[0][1], points[1][1]]
	new_one = [0, 0]
	new_two = [0, 0]
	if x[0] == x[1]:
		new_one[0] = new_two[0] = (x[0] + 1) % n
		new_one[1] = y[0]
		new_two[1] = y[1]
	elif y[0] == y[1]:
		new_one[1] = new_two[1] = (y[0] + 1) % n
		new_one[0] = x[0]
		new_two[0] = x[1]
	else:
		new_one = [x[0], y[1]]
		new_two = [x[1], y[0]]
	points.append(new_one)
	points.append(new_two)
	for i in range(n):
		for j in range(n):
			print('*' if [i, j] in points else '.', end='')
		print()

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


def main():
	N = int(input())
	S = []
	Coor = []
	for i in range(N):
		s = input()
		S.append(list(s))
		for j in range(N):
			if s[j] == '*':
				Coor.append((i, j))
	(H1, W1) = Coor[0]
	(H2, W2) = Coor[1]
	if H1 == H2:
		if H1 + 1 < N:
			S[H1 + 1][W1] = '*'
			S[H2 + 1][W2] = '*'
		else:
			S[H1 - 1][W1] = '*'
			S[H2 - 1][W2] = '*'
	elif W1 == W2:
		if W1 + 1 < N:
			S[H1][W1 + 1] = '*'
			S[H2][W2 + 1] = '*'
		else:
			S[H1][W1 - 1] = '*'
			S[H2][W2 - 1] = '*'
	else:
		S[H1][W2] = '*'
		S[H2][W1] = '*'
	for i in S:
		print(''.join(i))
T = int(input())
for _ in range(T):
	main()


def solve():
	n = int(input())
	w = []
	for i in range(n):
		q = input()
		if '*' not in q:
			continue
		for j in range(n):
			if q[j] == '*':
				w.append(i)
				w.append(j)
	(ax, ay, bx, by) = w
	(cx, cy, dx, dy) = w
	if ax != bx and ay != by:
		(cx, cy, dx, dy) = (max(ax, bx), max(ay, by), min(ax, bx), min(ay, by))
		if cx == bx and dx == ax and (cy == by) and (dy == ay):
			(cx, cy, dx, dy) = (max(ax, bx), min(ay, by), min(ax, bx), max(ay, by))
	elif ax == bx:
		if ax != 0:
			(cx, cy, dx, dy) = (ax - 1, ay, bx - 1, by)
		else:
			(cx, cy, dx, dy) = (ax + 1, ay, bx + 1, by)
	elif ay == by:
		if ay != 0:
			(cx, cy, dx, dy) = (ax, ay - 1, bx, dy - 1)
		else:
			(cx, cy, dx, dy) = (ax, ay + 1, bx, dy + 1)
	ans = [list('.' * n) for _ in range(n)]
	ans[ax][ay] = '*'
	ans[bx][by] = '*'
	ans[cx][cy] = '*'
	ans[dx][dy] = '*'
	t = []
	for i in ans:
		t.append(''.join(i))
	return '\n'.join(t)
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


t = int(input())
for i in range(t):
	n = int(input())
	row = list()
	x = list()
	y = list()
	for i in range(n):
		row.append(list(input()))
	for i in range(n):
		for j in range(n):
			if row[i][j] == '*':
				x.append(i)
				y.append(j)
	if x[0] == x[1]:
		if x[0] == 0:
			row[1][y[0]] = '*'
			row[1][y[1]] = '*'
		else:
			row[x[0] - 1][y[0]] = '*'
			row[x[0] - 1][y[1]] = '*'
	elif y[0] == y[1]:
		if y[0] == 0:
			row[x[0]][1] = '*'
			row[x[1]][1] = '*'
		else:
			row[x[0]][y[0] - 1] = '*'
			row[x[1]][y[1] - 1] = '*'
	else:
		row[x[0]][y[1]] = '*'
		row[x[1]][y[0]] = '*'
	for i in range(n):
		for j in range(n):
			print(row[i][j], end='')
		print()


import sys
import math
input = sys.stdin.readline
mod = 10 ** 9 + 7

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
for _ in range(inp()):
	n = inp()
	l = []
	r = -1
	c = -1
	r1 = -1
	c1 = -1
	for i in range(n):
		a = insr()
		l.append(a)
		for j in range(n):
			if a[j] == '*':
				if r == -1:
					r = i
					c = j
					continue
				if r1 == -1:
					r1 = i
					c1 = j
	if r1 == r:
		if r != n - 1:
			l[r + 1][c] = '*'
			l[r1 + 1][c1] = '*'
		else:
			l[r - 1][c] = '*'
			l[r1 - 1][c1] = '*'
	elif c1 == c:
		if c != n - 1:
			l[r][c + 1] = '*'
			l[r1][c + 1] = '*'
		else:
			l[r][c - 1] = '*'
			l[r1][c - 1] = '*'
	else:
		l[r][c1] = '*'
		l[r1][c] = '*'
	for i in range(n):
		print(''.join((j for j in l[i])))


for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	c = 0
	d = 0
	l = []
	for i in range(n):
		l.append(input())
	for i in range(n):
		for j in range(n):
			if l[i][j] == '*' and a == 0:
				a = [i, j]
			elif l[i][j] == '*' and b == 0:
				b = [i, j]
	if a[0] == b[0]:
		if a[0] + 1 < n:
			c = [a[0] + 1, a[1]]
			d = [a[0] + 1, b[1]]
		else:
			c = [a[0] - 1, a[1]]
			d = [a[0] - 1, b[1]]
	elif a[1] == b[1]:
		if a[1] + 1 < n:
			c = [a[0], a[1] + 1]
			d = [b[0], b[1] + 1]
		else:
			c = [a[0], a[1] - 1]
			d = [b[0], b[1] - 1]
	else:
		c = [a[0], b[1]]
		d = [b[0], a[1]]
	for i in range(n):
		s = ''
		for j in range(n):
			if [i, j] in [a, b, c, d]:
				s = s + '*'
			else:
				s = s + '.'
		print(s)


t = int(input())
for T in range(t):
	n = int(input())
	M = ''
	a = -1
	b = -1
	for i in range(n):
		M = M + input()
	for i in range(n ** 2):
		if M[i] == '*':
			if a == -1:
				a = i
			elif b == -1:
				b = i
	A = ['.' for i in range(n ** 2)]
	for i in range(n ** 2):
		if i == a // n * n + b % n or i == b // n * n + a % n or i == a or (i == b) or (i == b // n * n + a % n - 1 + (b % n == 0) * 2 and b % n == a % n) or (i == a // n * n + b % n - 1 + (a % n == 0) * 2 and b % n == a % n) or (i == b // n * n + a % n - n + n * (b // n == 0) * 2 and b // n == a // n) or (i == a // n * n + b % n - n + n * (a // n == 0) * 2 and b // n == a // n):
			A[i] = '*'
	for i in range(n):
		C = ''
		for i in range(i * n, i * n + n):
			C = C + A[i]
		print(C)


for _ in range(int(input())):
	n = int(input())
	a = [list(input()) for _ in range(n)]
	p = []
	for i in range(n):
		for j in range(n):
			if a[i][j] == '*':
				p.append((i, j))
	(h1, w1) = (p[0][0], p[0][1])
	(h2, w2) = (p[1][0], p[1][1])
	if h1 != h2 and w1 != w2:
		a[h2][w1] = '*'
		a[h1][w2] = '*'
	elif h1 == h2 and w1 != w2:
		if h1 == n - 1:
			a[h1 - 1][w1] = '*'
			a[h1 - 1][w2] = '*'
		else:
			a[h1 + 1][w1] = '*'
			a[h1 + 1][w2] = '*'
	elif h1 != h2 and w1 == w2:
		if w1 == n - 1:
			a[h1][w1 - 1] = '*'
			a[h2][w1 - 1] = '*'
		else:
			a[h1][w1 + 1] = '*'
			a[h2][w1 + 1] = '*'
	for aa in a:
		print(''.join(aa))


m = int(input())
u = []
for _ in range(m):
	a = int(input())
	l = []
	for i in range(a):
		l.append(list(input()))
	s = 0
	t = []
	for i in range(a):
		if l[i].count('*') > 0:
			for j in range(a):
				if l[i][j] == '*':
					t.append([i, j])
					s += 1
				if s == 2:
					break
			if s == 2:
				break
	if t[0][1] == t[1][1]:
		if t[0][1] == a - 1:
			l[t[0][0]][t[1][1] - 1] = '*'
			l[t[1][0]][t[0][1] - 1] = '*'
		else:
			l[t[0][0]][t[1][1] + 1] = '*'
			l[t[1][0]][t[0][1] + 1] = '*'
	elif t[0][0] == t[1][0]:
		if t[0][0] == a - 1:
			l[t[0][0] - 1][t[0][1]] = '*'
			l[t[1][0] - 1][t[1][1]] = '*'
		else:
			l[t[0][0] + 1][t[0][1]] = '*'
			l[t[1][0] + 1][t[1][1]] = '*'
	else:
		l[t[0][0]][t[1][1]] = '*'
		l[t[1][0]][t[0][1]] = '*'
	s = ''
	for i in l:
		s += ''.join(i) + '\n'
	u.append(s[:-1])
for i in u:
	print(i)


import sys
n = int(input())
for i in range(n):
	t = int(input())
	minx = 1000000000.0
	maxx = -1
	miny = 1000000000.0
	maxy = -1
	lines = []
	for j in range(t):
		line = input()
		lines.append(list(line))
		for k in range(t):
			if line[k] == '*':
				if j >= maxx:
					maxx = j
				if j <= minx:
					minx = j
				if k >= maxy:
					maxy = k
				if k <= miny:
					miny = k
	if miny == maxy:
		if miny < k - 1:
			maxy = miny + 1
		else:
			miny = miny - 1
	if minx == maxx:
		if minx < k - 1:
			maxx = minx + 1
		else:
			minx = minx - 1
	lines[minx][miny] = '*'
	lines[minx][maxy] = '*'
	lines[maxx][miny] = '*'
	lines[maxx][maxy] = '*'
	for l in lines:
		print(''.join(l))


num_inputs = int(input())
for _ in range(num_inputs):
	n = int(input())
	mat = []
	for __ in range(n):
		mat.append(list(input()))
	edges = []
	for i in range(len(mat)):
		for j in range(len(mat[0])):
			if mat[i][j] == '*':
				edges.append((i, j))
	((x1, y1), (x2, y2)) = edges
	if x1 == x2:
		if x1 + 1 >= len(mat[0]):
			mat[x1 - 1][y1] = '*'
			mat[x1 - 1][y2] = '*'
		else:
			mat[x1 + 1][y1] = '*'
			mat[x1 + 1][y2] = '*'
	elif y1 == y2:
		if y1 + 1 >= len(mat):
			mat[x1][y1 - 1] = '*'
			mat[x2][y1 - 1] = '*'
		else:
			mat[x1][y1 + 1] = '*'
			mat[x2][y1 + 1] = '*'
	else:
		mat[x1][y2] = '*'
		mat[x2][y1] = '*'
	for row in mat:
		print(''.join(row))


from sys import stdin
from collections import Counter
T = int(stdin.readline())
for t in range(T):
	n = int(stdin.readline())
	C = set()
	R = set()
	for i in range(n):
		L = stdin.readline()
		if '*' not in L:
			continue
		C.add(L.index('*'))
		C.add(L.rindex('*'))
		R.add(i)
	if len(R) == 1:
		if next(iter(R)) == 0:
			R.add(1)
		else:
			R.add(0)
	if len(C) == 1:
		if next(iter(C)) == 0:
			C.add(1)
		else:
			C.add(0)
	A = '.' * n
	B = ['.'] * n
	for c in C:
		B[c] = '*'
	B = ''.join(B)
	for i in range(n):
		if i in R:
			print(B)
		else:
			print(A)


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append([x for x in input()])
	lis = []
	for i in range(n):
		for j in range(n):
			if l[i][j] == '*':
				lis.append([i, j])
	u = lis[0][0]
	v = lis[0][1]
	x = lis[1][0]
	y = lis[1][1]
	if u == x:
		if u < n - 2:
			l[u + 1][v] = '*'
			l[u + 1][y] = '*'
		else:
			l[u - 1][v] = '*'
			l[u - 1][y] = '*'
	elif y == v:
		if v < n - 2:
			l[u][v + 1] = '*'
			l[x][y + 1] = '*'
		else:
			l[u][v - 1] = '*'
			l[x][y - 1] = '*'
	else:
		l[u][y] = '*'
		l[x][v] = '*'
	for i in range(n):
		for j in range(n):
			print(l[i][j], end='')
		print()


def arrIn():
	return list(map(int, input().split()))

def mapIn():
	return map(int, input().split())
for ii in range(int(input())):
	n = int(input())
	a = []
	for i in range(n):
		a.append(input())
	(x, y) = ([0, 0], [0, 0])
	flag = True
	for i in range(n):
		for j in range(n):
			if a[i][j] == '*':
				if flag:
					x[0] = i
					y[0] = j
					flag = False
				else:
					x[1] = i
					y[1] = j
					break
	if y[0] == y[1]:
		if y[0] > 0:
			y[0] -= 1
		else:
			y[0] += 1
	if x[0] == x[1]:
		if x[0] > 0:
			x[0] -= 1
		else:
			x[0] += 1
	for i in range(n):
		s = ''
		for j in range(n):
			if (i == x[0] or i == x[1]) and (j == y[0] or j == y[1]):
				s += '*'
			else:
				s += '.'
		print(s)


for t in range(int(input())):
	k = int(input())
	kl = [[i for i in input()] for _ in range(k)]
	x1 = -1
	y1 = -1
	x2 = -1
	y2 = -1
	for i in range(k):
		for j in range(k):
			if kl[i][j] == '*':
				if x1 == -1:
					x1 = i
					y1 = j
				else:
					x2 = i
					y2 = j
	kl[x1][y2] = '*'
	kl[x2][y1] = '*'
	if y1 == y2:
		if y1 != 0:
			kl[x1][0] = '*'
			kl[x2][0] = '*'
		else:
			kl[x1][1] = '*'
			kl[x2][1] = '*'
	elif x1 == x2:
		if x1 != 0:
			kl[0][y1] = '*'
			kl[0][y2] = '*'
		else:
			kl[1][y1] = '*'
			kl[1][y2] = '*'
	for t in kl:
		print(*t, sep='')


def solN():
	n = int(input())
	(p1, p2, p3, p4) = ([], [], [], [])
	for y in range(n):
		r = input()
		for i in range(n):
			if r[i] == '*':
				if p1 == []:
					p1.extend([y, i])
				else:
					p2.extend([y, i])
					break
	if p1[0] == p2[0]:
		if p1[0] == n - 1:
			p3.extend([n - 2, p1[1]])
			p4.extend([n - 2, p2[1]])
		else:
			p3.extend([p1[0] + 1, p1[1]])
			p4.extend([p1[0] + 1, p2[1]])
	elif p1[1] == p2[1]:
		if p1[1] == n - 1:
			p3.extend([p1[0], n - 2])
			p4.extend([p2[0], n - 2])
		else:
			p3.extend([p1[0], p1[1] + 1])
			p4.extend([p2[0], p1[1] + 1])
	else:
		p3.extend([p1[0], p2[1]])
		p4.extend([p2[0], p1[1]])
	for i in range(n):
		for y in range(n):
			if p1[0] == i and p1[1] == y or (p2[0] == i and p2[1] == y) or (p3[0] == i and p3[1] == y) or (p4[0] == i and p4[1] == y):
				print('*', end='')
			else:
				print('.', end='')
		print()

def main():
	for _ in range(int(input())):
		solN()
main()


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	(x1, y1) = (-1, -1)
	(x2, y2) = (0, 0)
	table = []
	for i in range(n):
		line = list(input())
		for j in range(n):
			if line[j] == '*':
				if x1 == -1:
					x1 = i
					y1 = j
				else:
					x2 = i
					y2 = j
		table.append(line)
	if x1 != x2 and y1 != y2:
		table[x1][y2] = '*'
		table[x2][y1] = '*'
	elif x1 == x2:
		if x1 != n - 1:
			table[x1 + 1][y1] = '*'
			table[x2 + 1][y2] = '*'
		else:
			table[x1 - 1][y1] = '*'
			table[x2 - 1][y2] = '*'
	elif y1 == y2:
		if y1 != n - 1:
			table[x1][y1 + 1] = '*'
			table[x2][y2 + 1] = '*'
		else:
			table[x1][y1 - 1] = '*'
			table[x2][y2 - 1] = '*'
	for i in range(n):
		for j in range(n):
			print(table[i][j], sep='', end='')
		print('')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = [list(input()) for i in range(n)]
	c = [(i, j) for i in range(n) for j in range(n) if a[i][j] == '*']
	if c[0][0] == c[1][0]:
		x1 = c[0][0] + 1
		y1 = c[0][1]
		y2 = c[1][1]
		if c[0][0] == n - 1:
			x1 = c[0][0] - 1
		a[x1][y1] = '*'
		a[x1][y2] = '*'
	elif c[0][1] == c[1][1]:
		y1 = c[0][1] + 1
		x1 = c[0][0]
		x2 = c[1][0]
		if c[0][1] == n - 1:
			y1 = c[0][1] - 1
		a[x1][y1] = '*'
		a[x2][y1] = '*'
	else:
		a[c[0][0]][c[1][1]] = '*'
		a[c[1][0]][c[0][1]] = '*'
	for i in range(n):
		for j in range(n):
			print(a[i][j], end='')
		print()


for _ in range(int(input())):
	n = int(input())
	mat = []
	for i in range(n):
		row = input()
		row = list(row)
		mat.append(row)
	p = []
	for i in range(n):
		for j in range(n):
			if mat[i][j] == '*':
				p.append((i, j))
	if p[0][0] == p[1][0]:
		row = p[0][0]
		col1 = p[0][1]
		col2 = p[1][1]
		if row == n - 1:
			row = row - 1
			mat[row][col1] = '*'
			mat[row][col2] = '*'
		else:
			row = row + 1
			mat[row][col1] = '*'
			mat[row][col2] = '*'
	elif p[0][1] == p[1][1]:
		col = p[0][1]
		row1 = p[0][0]
		row2 = p[1][0]
		if col == n - 1:
			col = col - 1
			mat[row1][col] = '*'
			mat[row2][col] = '*'
		else:
			col = col + 1
			mat[row1][col] = '*'
			mat[row2][col] = '*'
	else:
		row1 = p[0][0]
		col1 = p[0][1]
		row2 = p[1][0]
		col2 = p[1][1]
		mat[row2][col1] = '*'
		mat[row1][col2] = '*'
	for i in range(n):
		v = ''.join(mat[i])
		print(v)


p = int(input())
for i in range(p):
	n = int(input())
	main = []
	row_col = []
	for row in range(n):
		temp = list(input())
		main.append(temp)
		if len(row_col) < 2:
			indexes = [i for (i, x) in enumerate(temp) if x == '*']
			if len(indexes) == 1:
				row_col.append((row, indexes[0]))
			elif len(indexes) == 2:
				row_col = [(row, indexes[0]), (row, indexes[1])]
	if row_col[0][0] == row_col[1][0]:
		new_row = 0 if row_col[0][0] != 0 else 1
		main[new_row][row_col[0][1]] = '*'
		main[new_row][row_col[1][1]] = '*'
	elif row_col[0][1] == row_col[1][1]:
		new_column = 0 if row_col[0][1] != 0 else 1
		main[row_col[0][0]][new_column] = '*'
		main[row_col[1][0]][new_column] = '*'
	else:
		main[row_col[0][0]][row_col[0][1]] = '*'
		main[row_col[0][0]][row_col[1][1]] = '*'
		main[row_col[1][0]][row_col[0][1]] = '*'
		main[row_col[1][0]][row_col[1][1]] = '*'
	for i in main:
		print(''.join(i))


for _ in range(int(input())):
	n = int(input())
	g = []
	c = []
	for i in range(n):
		temp = list(input())
		if '*' in temp:
			c.append([i, temp.index('*')])
			if temp.count('*') == 2:
				c.append([i, temp.index('*', c[0][1] + 1)])
		g.append(temp)
	a = c[0]
	b = c[1]
	if a[0] == b[0]:
		if a[0] < n - 1:
			g[a[0] + 1][a[1]] = '*'
			g[a[0] + 1][b[1]] = '*'
		else:
			g[a[0] - 1][a[1]] = '*'
			g[a[0] - 1][b[1]] = '*'
	elif a[1] == b[1]:
		if a[1] < n - 1:
			g[a[0]][a[1] + 1] = '*'
			g[b[0]][b[1] + 1] = '*'
		else:
			g[a[0]][a[1] - 1] = '*'
			g[b[0]][b[1] - 1] = '*'
	else:
		g[a[0]][b[1]] = '*'
		g[b[0]][a[1]] = '*'
	for i in range(n):
		print(''.join(g[i]))


import sys
input = sys.stdin.readline
for test in range(int(input())):
	n = int(input())
	rows = set()
	columns = set()
	matrix = []
	for test in range(n):
		matrix.append(list(input()[:-1]))
	rows = set()
	columns = set()
	for i in range(n):
		for j in range(n):
			if matrix[i][j] == '*':
				rows.add(i)
				columns.add(j)
	if len(rows) == 1:
		x = list(rows)[0]
		if x + 1 < n:
			rows.add(x + 1)
		else:
			rows.add(x - 1)
	if len(columns) == 1:
		x = list(columns)[0]
		if x + 1 < n:
			columns.add(x + 1)
		else:
			columns.add(x - 1)
	for i in rows:
		for j in columns:
			matrix[i][j] = '*'
	print('\n'.join((''.join(i) for i in matrix)))


n = int(input())
for z in range(n):
	t = int(input())
	x = []
	y = []
	l = [list(str(input())) for _ in range(t)]
	d = {}
	for i in range(t):
		for j in range(t):
			if l[i][j] == '*':
				x.append(i)
				y.append(j)
	k = list(zip(x, y))
	if k[0][0] != k[1][0]:
		if k[0][0] > k[1][0] and k[0][1] != k[1][1]:
			first_x = k[0][0]
			first_y = k[1][1]
			second_x = k[1][0]
			second_y = k[0][1]
		elif k[0][0] < k[1][0] and k[0][1] != k[1][1]:
			first_x = k[1][0]
			first_y = k[0][1]
			second_x = k[0][0]
			second_y = k[1][1]
		if k[0][1] == k[1][1]:
			if l[k[0][0]][-1] == '*':
				first_x = k[0][0]
				first_y = k[0][1] - 1
				second_x = k[1][0]
				second_y = k[1][1] - 1
			else:
				first_x = k[0][0]
				first_y = k[0][1] + 1
				second_x = k[1][0]
				second_y = k[1][1] + 1
	if k[0][0] == k[1][0]:
		if l[0][k[0][1]] == '*':
			first_x = k[0][0] + 1
			first_y = k[0][1]
			second_x = k[1][0] + 1
			second_y = k[1][1]
		else:
			first_x = k[0][0] - 1
			first_y = k[0][1]
			second_x = k[1][0] - 1
			second_y = k[1][1]
	l[first_x][first_y] = '*'
	l[second_x][second_y] = '*'
	for i in range(t):
		print(''.join(l[i]))


t = int(input())
for x in range(t):
	n = int(input())
	a = [list(input()) for i in range(n)]
	c = [(i, j) for i in range(n) for j in range(n) if a[i][j] == '*']
	if c[0][0] == c[1][0]:
		if c[0][0] < n - 1:
			c.append((c[0][0] + 1, c[0][1]))
			c.append((c[0][0] + 1, c[1][1]))
		else:
			c.append((c[0][0] - 1, c[0][1]))
			c.append((c[0][0] - 1, c[1][1]))
	elif c[0][1] == c[1][1]:
		if c[0][1] < n - 1:
			c.append((c[0][0], c[0][1] + 1))
			c.append((c[1][0], c[1][1] + 1))
		else:
			c.append((c[0][0], c[0][1] - 1))
			c.append((c[1][0], c[1][1] - 1))
	else:
		c.append((c[0][0], c[1][1]))
		c.append((c[1][0], c[0][1]))
	for i in range(n):
		for j in range(n):
			if (i, j) in c:
				print('*', end='')
			else:
				print('.', end='')
		print('\n', end='')


t = int(input())
while t > 0:
	n = int(input())
	li = []
	li2 = []
	c = 0
	for x in range(0, n):
		li1 = input()
		li.append(li1)
	for x in range(n):
		st = li[x]
		for y in range(n):
			if st[y] == '*':
				li2.append(x)
				li2.append(y)
				c += 1
			if c == 2:
				break
		if c == 2:
			break
	li3 = []
	if li2[0] == li2[2]:
		if li2[0] == 0:
			li3.append(li2[0] + 1)
			li3.append(li2[1])
			li3.append(li2[0] + 1)
			li3.append(li2[3])
		else:
			li3.append(li2[0] - 1)
			li3.append(li2[1])
			li3.append(li2[0] - 1)
			li3.append(li2[3])
	elif li2[1] == li2[3]:
		if li2[1] == 0:
			li3.append(li2[0])
			li3.append(li2[1] + 1)
			li3.append(li2[2])
			li3.append(li2[1] + 1)
		else:
			li3.append(li2[0])
			li3.append(li2[1] - 1)
			li3.append(li2[2])
			li3.append(li2[1] - 1)
	else:
		li3.append(li2[0])
		li3.append(li2[3])
		li3.append(li2[2])
		li3.append(li2[1])
	for x in range(n):
		for y in range(n):
			if x == li3[0] and y == li3[1]:
				print('*', end='')
			elif x == li3[2] and y == li3[3]:
				print('*', end='')
			else:
				print(li[x][y], end='')
		print()
	t -= 1


for i in range(int(input())):
	n = int(input())
	a = []
	ar = []
	indexes = []
	for p in range(n):
		a = input()
		if '*' in a:
			indexes.append(p)
		ar.append(a)
	indexes_in = []
	for p in indexes:
		for q in range(n):
			if ar[p][q] == '*':
				indexes_in.append(q)
	p1 = []
	p2 = []
	if len(indexes) == 1:
		p1.append((indexes[0] + 1) % n)
		p1.append(indexes_in[0])
		p2.append((indexes[0] + 1) % n)
		p2.append(indexes_in[1])
	elif indexes_in[0] == indexes_in[1]:
		p1.append(indexes[0])
		p1.append((indexes_in[0] + 1) % n)
		p2.append(indexes[1])
		p2.append((indexes_in[1] + 1) % n)
	else:
		p1.append(indexes[0])
		p1.append(indexes_in[1])
		p2.append(indexes[1])
		p2.append(indexes_in[0])
	ar[p1[0]] = ar[p1[0]][:p1[1]] + '*' + ar[p1[0]][p1[1] + 1:]
	ar[p2[0]] = ar[p2[0]][:p2[1]] + '*' + ar[p2[0]][p2[1] + 1:]
	for p in ar:
		print(p)


class Solve:

	def _solve(self):
		n = int(input())
		mp = [input() for _ in range(n)]
		(a, b) = (None, None)
		for i in range(n):
			for (j, symb) in enumerate(mp[i]):
				if symb == '*':
					if not a:
						a = (i, j)
					else:
						b = (i, j)

		def upd_ln(ln, col, s='*'):
			return ln[:col] + s + ln[col + 1:]
		if a[0] == b[0]:
			stri = (a[0] + 1) % n
			mp[stri] = upd_ln(mp[stri], a[1])
			mp[stri] = upd_ln(mp[stri], b[1])
		elif a[1] == b[1]:
			coli = (a[1] + 1) % n
			stri = a[0]
			mp[stri] = upd_ln(mp[stri], coli)
			stri = b[0]
			mp[stri] = upd_ln(mp[stri], coli)
		else:
			stri = a[0]
			coli = b[1]
			mp[stri] = upd_ln(mp[stri], coli)
			stri = b[0]
			coli = a[1]
			mp[stri] = upd_ln(mp[stri], coli)
		print('\n'.join(mp))

	def solve(self):
		t = int(input())
		for i in range(t):
			self._solve()
Solve().solve()


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(list(input()))
	p = []
	for i in range(n):
		for (j, char) in enumerate(l[i]):
			if char == '*':
				p.append([i, j])
	if p[0][0] == p[1][0]:
		if p[0][0] == 0:
			l[1][p[0][1]] = '*'
			l[1][p[1][1]] = '*'
		else:
			l[0][p[0][1]] = '*'
			l[0][p[1][1]] = '*'
	elif p[0][1] == p[1][1]:
		if p[0][1] == 0:
			l[p[0][0]][1] = '*'
			l[p[1][0]][1] = '*'
		else:
			l[p[0][0]][0] = '*'
			l[p[1][0]][0] = '*'
	else:
		l[p[0][0]][p[1][1]] = '*'
		l[p[1][0]][p[0][1]] = '*'
	for k in l:
		print(''.join(k))


while True:
	try:
		t = eval(input())
		for i in range(t):
			n = eval(input())
			list0 = []
			list1 = []
			for j in range(n):
				list0.append(list(input()))
				for k in range(n):
					if list0[j][k] == '*':
						list1.append(j)
						list1.append(k)
			if list1[0] == list1[2]:
				if list1[0] == 0:
					list1[0] = list1[2] = 1
				else:
					list1[0] = list1[2] = 0
			elif list1[1] == list1[3]:
				if list1[1] == 0:
					list1[1] = list1[3] = 1
				else:
					list1[1] = list1[3] = 0
			list0[list1[0]][list1[3]] = '*'
			list0[list1[2]][list1[1]] = '*'
			for j in range(n):
				print(''.join(list0[j]), end='\n')
	except:
		break


q = int(input())
for i in range(q):
	x = int(input())
	a = []
	for i in range(x):
		a.append(list(input()))
	b = []
	for i in range(x):
		for j in range(x):
			if a[i][j] == '*':
				b.append([i, j])
	if b[0][0] == b[1][0]:
		if b[0][0] + 1 < x:
			a[b[0][0] + 1][b[0][1]] = '*'
		else:
			a[b[0][0] - 1][b[0][1]] = '*'
		if b[1][0] + 1 < x:
			a[b[1][0] + 1][b[1][1]] = '*'
		else:
			a[b[1][0] - 1][b[1][1]] = '*'
	elif b[0][1] == b[1][1]:
		if b[0][1] + 1 < x:
			a[b[0][0]][b[0][1] + 1] = '*'
		else:
			a[b[0][0]][b[0][1] - 1] = '*'
		if b[1][1] + 1 < x:
			a[b[1][0]][b[1][1] + 1] = '*'
		else:
			a[b[1][0]][b[1][1] - 1] = '*'
	else:
		a[b[0][0]][b[1][1]] = '*'
		a[b[1][0]][b[0][1]] = '*'
	for i in range(x):
		print(''.join(a[i]))


import sys
import math
import collections
t = int(input())
for w in range(t):
	n = int(input())
	l = []
	for i in range(n):
		l.append(list(input()))
	c = 0
	for i in range(n):
		for j in range(n):
			if l[i][j] == '*':
				if c == 0:
					c += 1
					t1 = (i, j)
				else:
					c += 1
					t2 = (i, j)
					break
		if c == 2:
			break
	if t1[0] == t2[0]:
		if t1[0] == n - 1:
			(l[t1[0] - 1][t1[1]], l[t2[0] - 1][t2[1]]) = ('*', '*')
		else:
			(l[t1[0] + 1][t1[1]], l[t2[0] + 1][t2[1]]) = ('*', '*')
	elif t1[1] == t2[1]:
		if t1[1] == n - 1:
			(l[t1[0]][t1[1] - 1], l[t2[0]][t2[1] - 1]) = ('*', '*')
		else:
			(l[t1[0]][t1[1] + 1], l[t2[0]][t2[1] + 1]) = ('*', '*')
	else:
		(l[t1[0]][t2[1]], l[t2[0]][t1[1]]) = ('*', '*')
	for i in range(n):
		print(''.join(l[i]))