Casimir has a rectangular piece of paper with a checkered field of size $n \times m$. Initially, all cells of the field are white.

Let us denote the cell with coordinates $i$ vertically and $j$ horizontally by $(i, j)$. The upper left cell will be referred to as $(1, 1)$ and the lower right cell as $(n, m)$.

Casimir draws ticks of different sizes on the field. A tick of size $d$ ($d > 0$) with its center in cell $(i, j)$ is drawn as follows:

First, the center cell $(i, j)$ is painted black.

Then exactly $d$ cells on the top-left diagonally to the center and exactly $d$ cells on the top-right diagonally to the center are also painted black.

That is all the cells with coordinates $(i - h, j \pm h)$ for all $h$ between $0$ and $d$ are painted. In particular, a tick consists of $2d + 1$ black cells.

An already painted cell will remain black if painted again. Below you can find an example of the $4 \times 9$ box, with two ticks of sizes $2$ and $3$.

You are given a description of a checkered field of size $n \times m$. Casimir claims that this field came about after he drew some (possibly $0$) ticks on it. The ticks could be of different sizes, but the size of each tick is at least $k$ (that is, $d \ge k$ for all the ticks).

Determine whether this field can indeed be obtained by drawing some (possibly none) ticks of sizes $d \ge k$ or not.


-----Input-----

The first line contains an integer $t$ ($1 \leq t \leq 100$) — the number test cases.

The following lines contain the descriptions of the test cases.

The first line of the test case description contains the integers $n$, $m$, and $k$ ($1 \le k \le n \le 10$; $1 \le m \le 19$) — the field size and the minimum size of the ticks that Casimir drew. The following $n$ lines describe the field: each line consists of $m$ characters either being '.' if the corresponding cell is not yet painted or '*' otherwise.


-----Output-----

Print $t$ lines, each line containing the answer to the corresponding test case. The answer to a test case should be YES if the given field can be obtained by drawing ticks of at least the given size and NO otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes, and YES will all be recognized as positive answers).


-----Examples-----

Input
8
2 3 1
*.*
...
4 9 2
*.*.*...*
.*.*...*.
..*.*.*..
.....*...
4 4 1
*.*.
****
.**.
....
5 5 1
.....
*...*
.*.*.
..*.*
...*.
5 5 2
.....
*...*
.*.*.
..*.*
...*.
4 7 1
*.....*
.....*.
..*.*..
...*...
3 3 1
***
***
***
3 5 1
*...*
.***.
.**..
Output
NO
YES
YES
YES
NO
NO
NO
NO


-----Note-----

The first sample test case consists of two asterisks neither of which can be independent ticks since ticks of size $0$ don't exist.

The second sample test case is already described in the statement (check the picture in the statement). This field can be obtained by drawing ticks of sizes $2$ and $3$, as shown in the figure.

The field in the third sample test case corresponds to three ticks of size $1$. Their center cells are marked with $\color{blue}{\text{blue}}$, ${\text{red}}$ and $\color{green}{\text{green}}$ colors:

*.*.

*$\color{blue}{\textbf{*}}$**

.$\color{green}{\textbf{*}}{\textbf{*}}$.

....

The field in the fourth sample test case could have been obtained by drawing two ticks of sizes $1$ and $2$. Their vertices are marked below with $\color{blue}{\text{blue}}$ and ${\text{red}}$ colors respectively:

.....

*...*

.*.*.

..${\textbf{*}}$.*

...$\color{blue}{\textbf{*}}$.

The field in the fifth sample test case can not be obtained because $k = 2$, and the last asterisk in the fourth row from the top with coordinates $(4, 5)$ can only be a part of a tick of size $1$.

The field in the sixth sample test case can not be obtained because the top left asterisk $(1, 1)$ can't be an independent tick, since the sizes of the ticks must be positive, and cannot be part of a tick with the center cell in the last row, since it is separated from it by a gap (a point, '.') in $(2, 2)$.

In the seventh sample test case, similarly, the field can not be obtained by the described process because the asterisks with coordinates $(1, 2)$ (second cell in the first row), $(3, 1)$ and $(3, 3)$ (leftmost and rightmost cells in the bottom) can not be parts of any ticks.

Source: codeforces | Difficulty: MEDIUM
Tags: Implementation

Greedy algorithms


Solutions:
from collections import deque, defaultdict
from math import sqrt, ceil, factorial, floor, inf, log2, sqrt, gcd
import bisect
import copy
from itertools import combinations
import sys
import heapq

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(n, m, k) = get_ints()
	arr = []
	for i in range(n):
		s = input()
		arr.append(s)
	dp = [[False for i in range(m)] for j in range(n)]
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				(p, q) = (i, j)
				(r, s) = (i, j)
				tot = 0
				while True:
					p -= 1
					q -= 1
					r -= 1
					s += 1
					if p >= 0 and r >= 0 and (q >= 0) and (s < m) and (arr[p][q] == '*') and (arr[r][s] == '*'):
						tot += 1
					else:
						break
				if tot >= k:
					dp[i][j] = True
					(p, q) = (i, j)
					(r, s) = (i, j)
					for j in range(tot):
						p -= 1
						q -= 1
						r -= 1
						s += 1
						dp[p][q] = True
						dp[r][s] = True
	flag = True
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*' and dp[i][j] == False:
				flag = False
				break
	if flag == False:
		print('NO')
	else:
		print('YES')


import sys
input = lambda : sys.stdin.readline().rstrip()
import bisect
import itertools
from collections import deque

def findtick(a, n, m, k, i, j, used):
	if a[i][j] != '*':
		return -1
	for d in range(0, 100):
		if 0 <= i - d < n and 0 <= j - d < m:
			if a[i - d][j - d] == '*':
				continue
			else:
				break
		else:
			break
	msize = d
	for d in range(0, 100):
		if 0 <= i - d < n and 0 <= j + d < m:
			if a[i - d][j + d] == '*':
				continue
			else:
				break
		else:
			break
	psize = d
	x = min(msize, psize)
	if x - 1 >= k:
		for d in range(x):
			used[i - d][j - d] = True
			used[i - d][j + d] = True
		return x - 1
	else:
		return -1

def solve():
	(n, m, k) = map(int, input().split())
	a = [list(input()) for _ in range(n)]
	used = [[False] * m for _ in range(n)]
	ans = []
	for i in range(n):
		for j in range(m):
			x = findtick(a, n, m, k, i, j, used)
			if x > 0:
				ans.append(x)
	for i in range(n):
		for j in range(m):
			if used[i][j] == False and a[i][j] == '*':
				print('No')
				return
	print('Yes')
t = int(input())
for _ in range(t):
	solve()


t = int(input())

def node(x, y, dis):
	for i in range(1, dis + 1):
		if a[x - i][y - i] == 0 or a[x - i][y + i] == 0:
			return 0
	boo[x][y] = 1
	for i in range(1, dis + 1):
		boo[x - i][y - i] = 1
		boo[x - i][y + i] = 1
	return 1

def check(x, y):
	c = 0
	for dis in range(k, n - x):
		if y + dis >= m or y + dis * 2 >= m:
			return
		if a[x + dis][y + dis] == 1:
			if node(x + dis, y + dis, dis) == 0:
				continue
			else:
				c = 1
				continue
	return c

def f():
	for x in range(n):
		for y in range(m):
			if a[x][y]:
				if check(x, y) == 0 and boo[x][y] == 0:
					print('NO')
					return
	for x in range(n):
		for y in range(m):
			if a[x][y] != boo[x][y]:
				print('NO')
				return
	print('YES')
while t:
	(n, m, k) = list(map(int, input().split()))
	a = []
	for i in range(n):
		s = [1 if j == '*' else 0 for j in input()]
		a.append(s)
	boo = [[0 for i in a[j]] for j in range(n)]
	f()
	t -= 1


from collections import Counter, deque
from sys import stdout
import time
from math import factorial, log

def main():
	(n, m, k) = [int(i) for i in input().split()]
	matrix = [input() for i in range(n)]
	_all = 0
	_b = set()
	for y in range(n):
		for x in range(m):
			flag = False
			b = set()
			element = matrix[y][x]
			if element == '*':
				_all += 1
				if x >= k and y >= k:
					for d in range(1, y + 1):
						el1 = matrix[y - d][x - d] if x >= d and y - d >= 0 else False
						el2 = matrix[y - d][x + d] if x + d < m and y - d >= 0 else False
						(el1, el2) = map(lambda z: False if not z or z == '.' else True, [el1, el2])
						if el1 and el2:
							if d >= k:
								flag = True
							b.add((y - d, x + d))
							b.add((y - d, x - d))
						else:
							break
					if flag:
						_b.add((y, x))
						_b |= b
	if len(_b) == _all:
		print('YES')
	else:
		print('NO')
for t in range(int(input())):
	main()


try:
	t = int(input())
	for i in range(t):
		(n, m, k) = map(int, input().split())
		a = []
		for j in range(n):
			x = input()
			a.append(list(x))
		done = {}
		possible = 1
		for j in range(n - 1, -1, -1):
			for j2 in range(m - 1, -1, -1):
				if a[j][j2] == '*':
					count = 0
					for i2 in range(j - 1, -1, -1):
						if j2 + count + 1 < m and j2 - count - 1 >= 0:
							if a[i2][j2 + count + 1] == '*' and a[i2][j2 - count - 1] == '*':
								count += 1
							else:
								break
					if count >= k:
						done[j, j2] = 1
						count = 0
						for i2 in range(j - 1, -1, -1):
							if j2 + count + 1 < m and j2 - count - 1 >= 0:
								if a[i2][j2 + count + 1] == '*' and a[i2][j2 - count - 1] == '*':
									count += 1
									done[i2, j2 + count] = 1
									done[i2, j2 - count] = 1
								else:
									break
					if done.setdefault((j, j2), 0) == 0:
						possible = 0
						break
			if possible == 0:
				break
		if possible == 1:
			print('YES')
		else:
			print('NO')
except:
	pass


for _ in range(int(input())):
	(n, m, k) = list(map(int, input().split()))
	lst = [0] * n
	for i in range(n):
		lst[n - 1 - i] = list(input())
	for i in range(n):
		for j in range(m):
			kor = []
			ks = 0
			if lst[i][j] == '*' or lst[i][j] == '0':
				kor += [[i, j]]
				(x, y1, y2) = (i, j, j)
				while x + 1 < n and y1 - 1 > -1 and (y2 + 1 < m):
					x += 1
					y1 -= 1
					y2 += 1
					if lst[x][y1] == lst[x][y2] == '*' or lst[x][y1] == lst[x][y2] == '0' or ((lst[x][y1] == '*' or lst[x][y1] == '0') and (lst[x][y2] == '*' or lst[x][y2] == '0')):
						kor += [[x, y1]]
						kor += [[x, y2]]
						ks += 1
					else:
						break
				if ks >= k:
					for z in kor:
						lst[z[0]][z[1]] = '0'
	cnt = 0
	for i in lst:
		for j in i:
			if j == '*':
				cnt += 1
				print('NO')
				break
		if cnt:
			break
	if not cnt:
		print('YES')


def verify(n, m, k, grid, i, j, visited):
	height = 0
	startj = j
	endj = j
	row = i
	while startj >= 0 and endj < m and (i >= 0):
		if grid[i][startj] != grid[i][endj]:
			break
		if grid[i][startj] == '.':
			break
		i -= 1
		startj -= 1
		endj += 1
		height += 1
	height -= 1
	if height < k:
		return
	startj = j
	endj = j
	i = row
	while startj >= 0 and endj < m and (i >= 0):
		if grid[i][startj] != grid[i][endj]:
			break
		if grid[i][startj] == '.':
			break
		visited[i][startj] = True
		visited[i][endj] = True
		i -= 1
		startj -= 1
		endj += 1

def solve(n, m, k, grid):
	visited = [[False for _ in range(m)] for _ in range(n)]
	for i in range(n):
		for j in range(m):
			if grid[i][j] != '*':
				continue
			verify(n, m, k, grid, i, j, visited)
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*' and visited[i][j] is False:
				return 'NO'
	return 'YES'
t = int(input().strip())
inputs = []
for _ in range(t):
	(n, m, k) = map(int, input().strip().split())
	grid = []
	for _ in range(n):
		grid.append(input().strip())
	inputs.append((n, m, k, grid))
for (n, m, k, grid) in inputs:
	print(solve(n, m, k, grid))


from sys import stdin

def read_input():
	(n, m, k) = map(int, stdin.readline().split())
	a = ['.' * (m + 2)]
	for _ in range(1, n + 1):
		a.append('.' + stdin.readline().rstrip() + '.')
	return (n, m, k, a)

def solve(n, m, k, a):
	check = [[False] * (m + 2) for _ in range(n + 1)]
	for i in range(n, 0, -1):
		for j in range(1, m + 1):
			if a[i][j] == '*':
				d = 0
				while a[i - d - 1][j - d - 1] == '*' and a[i - d - 1][j + d + 1] == '*':
					d += 1
				if d >= k:
					d = 0
					check[i][j] = True
					while a[i - d - 1][j - d - 1] == '*' and a[i - d - 1][j + d + 1] == '*':
						check[i - d - 1][j - d - 1] = check[i - d - 1][j + d + 1] = True
						d += 1
	for i in range(n, 0, -1):
		for j in range(1, m + 1):
			if a[i][j] == '*' and check[i][j] == False:
				return 'NO'
	return 'YES'

def main():
	t = int(stdin.readline())
	for _ in range(t):
		(n, m, k, a) = read_input()
		answer = solve(n, m, k, a)
		print(answer)
main()


from itertools import product
inputArray = lambda t: list(map(t, input().split(' ')))

def tickSize(board, i, j, m, k):
	sz = 0
	ub = min(m - j - 1, i, j)
	if ub < k:
		return 0
	while sz <= ub and board[i - sz][j - sz] == '*' and (board[i - sz][j + sz] == '*'):
		sz += 1
	return sz - 1

def drawTick(mask, i, j, size):
	mask[i][j] = '*'
	for h in range(1, size + 1):
		mask[i - h][j - h] = '*'
		mask[i - h][j + h] = '*'
	return mask

def generateMask(board, n, m, k):
	mask = []
	for _ in range(n):
		mask.append([])
		for _ in range(m):
			mask[-1].append('.')
	for (i, j) in product(range(n), range(m)):
		if board[i][j] == '*':
			size = tickSize(board, i, j, m, k)
			if size >= k:
				mask = drawTick(mask, i, j, size)
	return mask

def main():
	t = int(input())
	while t > 0:
		t -= 1
		(n, m, k) = inputArray(int)
		board = []
		for _ in range(n):
			board.append(list(input()))
		print('YES') if board == generateMask(board, n, m, k) else print('NO')
main()


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	grid = [[0] * m for i in range(n)]
	ok = True
	for i in range(n):
		s = input()
		for j in range(m):
			grid[i][j] = 1 if s[j] == '*' else 0
	for i in range(n - 1, -1, -1):
		for j in range(m):
			if grid[i][j] == 0:
				continue
			l = 0
			while j > l and i > l and (j + l + 1 < m):
				if grid[i - l - 1][j - l - 1] == 0 or grid[i - l - 1][j + l + 1] == 0:
					break
				l += 1
			if l >= k:
				for d in range(1 + l):
					grid[i - d][j - d] = 2
					grid[i - d][j + d] = 2
	for i in range(n):
		for j in range(m):
			if grid[i][j] == 1:
				ok = False
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	flag = True
	(n, m, k) = map(int, input().split())
	a = [[-1] * m for i in range(n)]
	for i in range(n):
		s = input()
		for j in range(m):
			if s[j] == '*':
				a[i][j] = 1
	for row in range(n - 1, -1, -1):
		for col in range(m):
			if a[row][col] == 1:
				mx = 0
				while col - mx >= 0 and col + mx <= m - 1 and (row - mx >= 0) and (a[row - mx][col - mx] >= 0) and (a[row - mx][col + mx] >= 0):
					mx += 1
				mx -= 1
				if mx < k:
					print('NO')
					flag = False
				else:
					for i in range(mx + 1):
						a[row - i][col - i] = 0
						a[row - i][col + i] = 0
			elif a[row][col] == 0:
				mx = 0
				while col - mx >= 0 and col + mx <= m - 1 and (row - mx >= 0) and (a[row - mx][col - mx] >= 0) and (a[row - mx][col + mx] >= 0):
					mx += 1
				mx -= 1
				if mx >= k:
					for i in range(mx + 1):
						a[row - i][col - i] = 0
						a[row - i][col + i] = 0
			if not flag:
				break
		if not flag:
			break
	if flag:
		print('YES')


from sys import stdin
from io import StringIO
input = lambda : stdin.readline().strip()
linput = lambda : [*map(int, input().split())]
output = StringIO()

def lprint(*x):
	output.writelines((str(v) + ' ' for v in x))
	output.write('\n')

def main():
	(n, m, k) = linput()
	a = [[*input()] for _ in ' ' * n]
	v = [['.'] * m for _ in ' ' * n]

	def check(i, j):
		c = 0
		j1 = j2 = j
		while i > 0 and j1 > 0 and (j2 < m - 1):
			i -= 1
			j1 -= 1
			j2 += 1
			if a[i][j1] != '*' or a[i][j2] != '*':
				return c
			c += 1
		return c
	for j in range(m):
		for i in range(n):
			if a[i][j] == '*':
				d = check(i, j)
				if d >= k:
					for c in range(d + 1):
						v[i - c][j - c] = '*'
						v[i - c][j + c] = '*'
	lprint('YES' if a == v else 'NO')
for _ in ' ' * int(input()):
	main()
print(output.getvalue())


import math
import collections
from functools import lru_cache
import heapq

def process(case, n, m, k, G):
	verified = [[0 for _ in range(m)] for _ in range(n)]

	def check(x, y, G, k, verified):
		c = 0
		for d in range(m + n):
			if 0 <= x - d <= n - 1 and 0 <= y - d <= m - 1 and (0 <= y + d <= m - 1) and (G[x - d][y - d] == '*') and (G[x - d][y + d] == '*'):
				c += 1
			else:
				break
		if c > k:
			for d in range(m + n):
				if 0 <= x - d <= n - 1 and 0 <= y - d <= m - 1 and (0 <= y + d <= m - 1) and (G[x - d][y - d] == '*') and (G[x - d][y + d] == '*'):
					verified[x - d][y - d] = 1
					verified[x - d][y + d] = 1
				else:
					break
	for i in range(n):
		for j in range(m):
			if G[i][j] == '*':
				check(i, j, G, k, verified)
	for i in range(n):
		for j in range(m):
			if G[i][j] == '*' and verified[i][j] != 1:
				print('NO')
				return
	print('YES')
tcs = int(input())
for tc in range(tcs):
	(n, m, k) = list(map(int, input().split()))
	G = []
	for _ in range(n):
		G.append(input().rstrip())
	process(tc + 1, n, m, k, G)


t = int(input())
for _ in range(t):
	(n, m, k) = [int(x) for x in input().split()]
	board = ['.' * (m + 2)]
	for _ in range(n):
		board.append('.' + input().strip() + '.')
	board.append('.' * (m + 2))
	q = set()
	for (i, line) in enumerate(board):
		for (j, ch) in enumerate(line):
			if ch == '*':
				q.add((i, j))
	used = set()
	for (i, j) in q:
		g = {(i, j)}
		size = 0
		i = i
		j1 = j
		j2 = j
		while True:
			i -= 1
			j1 += 1
			j2 -= 1
			if board[i][j1] == board[i][j2] == '*':
				size += 1
				g.add((i, j1))
				g.add((i, j2))
			else:
				break
		if size >= k:
			used.update(g)
	if q == used:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	nums = list(map(int, input().split()))
	(n, m, k) = (nums[0], nums[1], nums[2])
	graph = [[] for _ in range(n)]
	points = set()
	for i in range(n):
		word = input()
		for j in range(m):
			graph[i].append(word[j])
			if word[j] == '*':
				points.add((i, j))
	check = set()
	qualified = set()

	def ops(radius):
		for posx in range(n):
			for posy in range(m):
				if posy - radius < 0 or posy + radius >= m:
					continue
				if posx - radius < 0:
					continue
				if graph[posx][posy] != '*':
					continue
				flag1 = all((graph[posx - h][posy - h] == '*' for h in range(1, radius + 1)))
				flag2 = all((graph[posx - h][posy + h] == '*' for h in range(1, radius + 1)))
				if flag1 and flag2:
					if (posx, posy) not in qualified:
						qualified.add((posx, posy))
					else:
						continue
					for h in range(radius + 1):
						check.add((posx - h, posy - h))
						check.add((posx - h, posy + h))
		return
	for i in range(min(n, m), k - 1, -1):
		ops(i)
	print(['NO', 'YES'][check == points])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, functools, copy
inf = float('inf')
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def LS():
	return input().split()

def endl():
	return print('\n')

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

def grayCode(n):
	return n ^ n >> 1
sys.setrecursionlimit(20000)
graph = collections.defaultdict(list)
grid = []
visited = set()
ways = ['D', 'U', 'R', 'L']
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]

def initGraph(m):
	for _ in range(m):
		(u, v) = LI()
		graph[u - 1].append(v - 1)
		graph[v - 1].append(u - 1)

def initGraphW(m):
	for _ in range(m):
		(a, b, c) = LI()
		graph[a - 1].append((b - 1, c))
		graph[b - 1].append((a - 1, c))

def initGrid(h, w):
	for i in range(h):
		s = S()
		grid.append(list(s))
	return grid

def soe(limit):
	a = [True] * limit
	a[0] = a[1] = False
	for (i, isprime) in enumerate(a):
		if isprime:
			yield i
			for n in range(i * i, limit, i):
				a[n] = False
	return a
for _ in range(I()):
	(n, m, k) = LI()
	grid = []
	grid = initGrid(n, m)
	visited = set()
	booly = True
	d = {}
	for r in range(n):
		for c in range(m):
			if grid[r][c] == '*':
				d[r, c] = 0
	for i in reversed(range(n)):
		for j in reversed(range(m)):
			if grid[i][j] == '*':
				visited.add((i, j))
				left = (i - 1, j - 1)
				right = (i - 1, j + 1)
				while True:
					if left[0] < 0 or left[1] < 0 or right[0] < 0 or (right[0] < 0):
						break
					cntL = 0
					if right[0] >= 0 and right[1] < m:
						if grid[right[0]][right[1]] == '*':
							cntL += 1
					if left[0] >= 0 and left[1] >= 0:
						if grid[left[0]][left[1]] == '*':
							cntL += 1
					if cntL == 2:
						pass
					else:
						break
					visited.add(left)
					visited.add(right)
					left = (left[0] - 1, left[1] - 1)
					right = (right[0] - 1, right[1] + 1)
				for x in visited:
					try:
						d[x] = max(d[x], len(visited))
					except KeyError:
						pass
				visited.clear()
	mn = mod
	for (kk, v) in d.items():
		mn = min(mn, v)
	if mn - (k + 1) >= k:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	c = [''] * n
	for i in range(n):
		c[i] = list(input())
	a = [['.'] * m for _ in range(n)]
	for i in range(n):
		for j in range(m):
			if c[i][j] == '*':
				ok = 1
				for h in range(k + 1):
					ok &= i >= h and j >= h and (c[i - h][j - h] == '*')
					ok &= i >= h and j + h < m and (c[i - h][j + h] == '*')
				if ok:
					for h in range(i + 1):
						if j >= h and c[i - h][j - h] == '*' and (j + h < m) and (c[i - h][j + h] == '*'):
							a[i - h][j - h] = a[i - h][j + h] = '*'
						else:
							break
	if a == c:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	vis = []
	grid = []
	flag = 1
	for i in range(n):
		vis.append([-1] * m)
	for i in range(n):
		grid.append(list(input()))
	for i in range(n - 1, -1, -1):
		for j in range(m):
			if grid[i][j] == '*':
				l = 1
				count = 0
				x = i - 1
				while j - l >= 0 and j + l < m and (x >= 0):
					if grid[x][j + l] == '*' and grid[x][j - l] == '*':
						count += 1
						x -= 1
						l += 1
					else:
						break
				if count >= k:
					l = 1
					x = i - 1
					while j - l >= 0 and j + l < m and (x >= 0):
						if grid[x][j + l] == '*' and grid[x][j - l] == '*':
							vis[x][j + l] = 1
							vis[x][j - l] = 1
							x -= 1
							l += 1
						else:
							break
				elif vis[i][j] == 1:
					pass
				else:
					flag = 0
					break
		if flag == 0:
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


def check(board, ticks, k):
	painted = set()
	for (row, col) in ticks:
		tmp = set()
		leg = 0
		while True:
			if 0 <= row - leg and 0 <= col - leg and (col + leg <= m - 1) and (board[row - leg][col - leg] == '*') and (board[row - leg][col + leg] == '*'):
				tmp.add((row - leg, col - leg))
				tmp.add((row - leg, col + leg))
				leg += 1
			else:
				if leg - 1 >= k:
					painted = painted.union(tmp)
				break
	for coord in ticks:
		if coord not in painted:
			return False
	return True
for case in range(int(input())):
	(n, m, k) = map(int, input().split())
	board = [[] for _ in range(n)]
	ticks_removed = set()
	ticks = []
	for i in range(n):
		tmp = input()
		for (idx, letter) in enumerate(tmp):
			if letter == '*':
				ticks.append((i, idx))
			board[i].append(letter)
	print('YES' if check(board, ticks, k) else 'NO')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	field = [input() for i in range(n)]
	res = [['.'] * m for i in range(n)]
	for i in range(1, n):
		for j in range(1, m - 1):
			if field[i][j] == '.':
				continue
			if field[i - 1][j - 1] == '.' or field[i - 1][j + 1] == '.':
				continue
			res[i][j] = '*'
			mini = 0
			for x in range(1, n + 1):
				if i - x < 0 or j - x < 0 or j + x >= m:
					break
				if field[i - x][j - x] == '.' or field[i - x][j + x] == '.':
					break
				mini = x
			if mini < k:
				continue
			for x in range(1, mini + 1):
				res[i - x][j - x] = '*'
				res[i - x][j + x] = '*'
	can = True
	for i in range(n):
		for j in range(m):
			if field[i][j] != res[i][j]:
				can = False
				break
			if not can:
				break
	if can:
		print('YES')
	else:
		print('NO')


def solve(n, m, k, grid):
	for i in range(n - 1, -1, -1):
		for j in range(m):
			if not grid[i][j]:
				continue
			d = 0
			while j - d - 1 >= 0 and j + d + 1 < m and (i - d - 1 >= 0):
				if grid[i - d - 1][j - d - 1] == 0 or grid[i - d - 1][j + d + 1] == 0:
					break
				d += 1
			if d >= k:
				for l in range(d + 1):
					grid[i - l][j - l] = 2
					grid[i - l][j + l] = 2
	for i in range(n):
		for j in range(m):
			if grid[i][j] == 1:
				return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	(n, m, k) = [int(x) for x in input().split()]
	grid = []
	for __ in range(n):
		row = []
		for c in input():
			if c == '.':
				row.append(0)
			else:
				row.append(1)
		grid.append(row)
	print(solve(n, m, k, grid))


def naiveSolve():
	return

def solve():
	return

def main():
	t = int(input())
	allans = []
	for _ in range(t):
		(n, m, k) = readIntArr()
		grid = []
		for __ in range(n):
			grid.append(input())
		arr = [['.' for __ in range(m)] for ___ in range(n)]
		for i in range(n):
			for j in range(m):
				if grid[i][j] == '*':
					d = 0
					i1 = i
					j1 = j2 = j
					while i1 - 1 >= 0 and j1 - 1 >= 0 and (j2 + 1 < m) and (grid[i1 - 1][j1 - 1] == grid[i1 - 1][j2 + 1] == '*'):
						d += 1
						i1 -= 1
						j1 -= 1
						j2 += 1
					if d >= k:
						i1 = i
						j1 = j2 = j
						for __ in range(d + 1):
							arr[i1][j1] = arr[i1][j2] = '*'
							i1 -= 1
							j1 -= 1
							j2 += 1
		ans = 'YES'
		for i in range(n):
			for j in range(m):
				if grid[i][j] != arr[i][j]:
					ans = 'NO'
		allans.append(ans)
	multiLineArrayPrint(allans)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(x):
	print('{}'.format(x))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(ans))
	sys.stdout.flush()
inf = float('inf')
from math import gcd, floor, ceil
for _abc in range(1):
	main()


from heapq import heappush, heappop
from collections import deque
t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	mat = []
	for i in range(n):
		s = input()
		mat.append(s)
	vis = [[0 for i in range(m)] for j in range(n)]
	for i in range(n - 1, -1, -1):
		for j in range(m):
			if mat[i][j] == '*':
				x = i - 1
				y = j - 1
				c = 0
				while x >= 0 and y >= 0 and (mat[x][y] == '*'):
					c += 1
					x -= 1
					y -= 1
				x = i - 1
				y = j + 1
				d = 0
				while x >= 0 and y < m and (mat[x][y] == '*'):
					d += 1
					x -= 1
					y += 1
				if min(c, d) >= k:
					mn = min(c, d)
					vis[i][j] = 1
					x = i - 1
					y = j - 1
					c = 1
					while c <= mn and x >= 0 and (y >= 0):
						vis[x][y] = 1
						c += 1
						x -= 1
						y -= 1
					x = i - 1
					y = j + 1
					d = 1
					while d <= mn and x >= 0 and (y < m):
						vis[x][y] = 1
						d += 1
						x -= 1
						y += 1
	b = 1
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '*':
				if vis[i][j] == 0:
					b = 0
					break
	if b == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin
lines = [line.strip() for line in stdin]
t = int(lines[0])
ln = 1
for _ in range(t):
	(n, m, k) = map(int, lines[ln].split())
	ln += 1
	g = [[1 if c == '*' else 0 for c in lines[ln + i]] for i in range(n)]
	ln += n
	ng = [[0] * m for i in range(n)]
	for i in range(n):
		for j in range(m):
			for d in range(k, 20):
				if not (i - d >= 0 and j - d >= 0 and (j + d < m)):
					break
				if all((g[i - h][j - h] and g[i - h][j + h] for h in range(d + 1))):
					for h in range(d + 1):
						ng[i - h][j - h] = 1
						ng[i - h][j + h] = 1
	print('YES' if g == ng else 'NO')


def check_con(a, n, m, x, y, k):
	X = x
	Y = y
	cnt1 = 0
	cnt2 = 0
	x -= 1
	y -= 1
	while x >= 0 and y >= 0:
		if a[x][y] == '*':
			cnt1 += 1
		else:
			break
		x -= 1
		y -= 1
	X -= 1
	Y += 1
	while X >= 0 and Y < m:
		if a[X][Y] == '*':
			cnt2 += 1
		else:
			break
		X -= 1
		Y += 1
	return min(cnt1, cnt2)
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	K = k
	a = []
	for i in range(n):
		x = input()
		a.append([])
		for j in x:
			a[-1].append(j)
	check = [[False for i in range(m)] for j in range(n)]
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*':
				cnt = check_con(a, n, m, i, j, K)
				if cnt >= K:
					check[i][j] = True
					for k in range(cnt):
						check[i - k - 1][j - k - 1] = True
						check[i - k - 1][j + k + 1] = True
	fcheck = False
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*' and (not check[i][j]):
				fcheck = True
				break
			elif a[i][j] != '*' and check[i][j]:
				fcheck = True
				break
		if fcheck:
			break
	if fcheck:
		print('NO')
	else:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
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')
from collections import defaultdict, deque
from math import ceil, floor, sqrt, log2, gcd, pi
from heapq import heappush, heappop
from bisect import bisect_left, bisect
from functools import reduce
import sys
abc = 'abcdefghijklmnopqrstuvwxyz'
ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	arr = [['.' for _ in range(m)] for _ in range(n)]
	for i in range(n):
		arr[i] = list(input())
	a = [['.' for _ in range(m)] for _ in range(n)]
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				ok = 1
				for h in range(k + 1):
					ok &= i >= h and j >= h and (arr[i - h][j - h] == '*')
					ok &= i >= h and j + h < m and (arr[i - h][j + h] == '*')
				if ok:
					for h in range(i + 1):
						if j >= h and i >= h and (j + h < m) and (arr[i - h][j - h] == '*') and (arr[i - h][j + h] == '*'):
							a[i - h][j - h] = '*'
							a[i - h][j + h] = '*'
						else:
							break
	if arr == a:
		print('YES')
	else:
		print('NO')


import sys
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

def solve():
	(n, m, k) = I()
	a = []
	centres = []
	for i in range(n):
		a.append(input())
		if i:
			for j in range(1, m - 1):
				if a[i][j] == a[i - 1][j - 1] == a[i - 1][j + 1] == '*':
					centres.append((i, j))
	visited = [[0] * m for i in range(n)]
	for (A, B) in centres:
		if A < k or B < k:
			continue
		cur = 1
		while A - cur >= 0 and B - cur >= 0 and (B + cur < m):
			if a[A - cur][B - cur] == '.' or a[A - cur][B + cur] == '.':
				break
			cur += 1
		if cur > k:
			visited[A][B] = 1
			cur = 1
			while A - cur >= 0 and B - cur >= 0 and (B + cur < m):
				if a[A - cur][B - cur] == '.' or a[A - cur][B + cur] == '.':
					break
				visited[A - cur][B - cur] = visited[A - cur][B + cur] = 1
				cur += 1
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*' and (not visited[i][j]):
				print('NO')
				return
	print('YES')
(t,) = I()
while t:
	solve()
	t -= 1


import math
import heapq
import string
from collections import deque
from bisect import bisect, bisect_left, bisect_right, insort
import sys
input = sys.stdin.readline
S = lambda : input().rstrip()
I = lambda : int(S())
M = lambda : map(int, S().split())
L = lambda : list(M())
H = 1000000000 + 7
for _ in range(I()):
	(n, m, k) = M()
	l = []
	d = [[0 for i in range(m)] for j in range(n)]
	for i in range(n):
		l.append(S())
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*':
				h = 1
				while i - h >= 0 and j - h >= 0 and (j + h < m) and (l[i - h][j - h] == '*') and (l[i - h][j + h] == '*'):
					h += 1
				if h - 1 >= k:
					for t in range(h):
						d[i - t][j - t] = 1
						d[i - t][j + t] = 1
	f = 0
	for i in range(n):
		for j in range(m):
			if d[i][j] == 0 and l[i][j] == '*':
				f = 1
				break
		if f == 1:
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


import sys
import math
from bisect import bisect_left
import heapq
from collections import deque
from itertools import product, permutations
import random

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()

def C(n, k, mod):
	return FACT(n, mod) * pow(FACT(k, mod) * FACT(n - k, mod) % mod, mod - 2, mod) % mod

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

def helper(a, n):
	b = [0 for i in range(len(a))]
	for i in range(len(a)):
		b[(i - n) % len(a)] = a[i]
	return b
for _ in range(II()):
	(n, m, k) = MI()
	l = []
	boo = True
	v = [['.' for _ in range(m)] for _ in range(n)]
	for i in range(n):
		l.append(list(SI()))
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*':
				for x in range(k, n + 1):
					boo = True
					for y in range(x + 1):
						if i - y < 0 or j + y >= m or j - y < 0:
							boo = False
							break
						if not l[i - y][j + y] == l[i - y][j - y] == '*':
							boo = False
							break
					if boo:
						for y in range(x + 1):
							v[i - y][j + y] = v[i - y][j - y] = '*'
	boo = l == v
	print('YES' if boo else 'NO')


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = [list(input().strip()) for i in range(n)]
	b = [['.'] * m for i in range(n)]
	for x in range(n):
		for y in range(m):
			if a[x][y] == '*':
				d = 0
				for i in range(1, x + 1):
					if y - i >= 0 and y + i < m and (a[x - i][y - i] == '*') and (a[x - i][y + i] == '*'):
						d = i
					else:
						break
				if d >= k:
					for i in range(d + 1):
						b[x - i][y - i] = '*'
						b[x - i][y + i] = '*'
	print(['NO', 'YES'][a == b])


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

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')
import heapq
from collections import deque
import heapq
t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	b = []
	for u in range(n):
		s = input()
		b.append(s)
	vis = [[False for j in range(m)] for i in range(n)]
	for i in range(n):
		for j in range(m):
			if b[i][j] == '*':
				c = 0
				while i - c >= 0 and j - c >= 0 and (j + c < m):
					if b[i - c][j - c] == '*' and b[i - c][j + c] == '*':
						c += 1
					else:
						break
				if c >= k + 1:
					c = 0
					while i - c >= 0 and j - c >= 0 and (j + c < m):
						if b[i - c][j - c] == '*' and b[i - c][j + c] == '*':
							vis[i - c][j - c] = True
							vis[i - c][j + c] = True
							c += 1
						else:
							break
	poss = 1
	for i in range(n):
		for j in range(m):
			if not vis[i][j] and b[i][j] == '*':
				poss = 0
				break
	if poss:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, k) = list(map(int, input().split()))
	arr = []
	for i in range(n):
		x = input()
		for j in range(m):
			if x[j] == '*':
				arr.append((i, j))
	arr = sorted(arr, key=lambda x: (-x[0], x[1]))
	arrset = set(arr)
	seen = set()
	for xy in arr:
		cout = 0
		r = xy[0]
		cr = xy[1]
		cl = xy[1]
		f = True
		temp = set()
		while f:
			if (r - 1, cr + 1) in arrset and (r - 1, cl - 1) in arrset:
				cout += 1
				temp.add((r - 1, cr + 1))
				temp.add((r - 1, cl - 1))
				cr += 1
				cl -= 1
				r -= 1
			else:
				f = False
		if cout >= k:
			seen.add(xy)
			seen.update(temp)
	if len(seen) == len(arr):
		print('YES')
	else:
		print('NO')


def fun(mat, n, m, k):
	dp1 = [[0 for i in range(m)] for i in range(n)]
	h = set()
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '*':
				h.add((i, j))
			if mat[i][j] == '.':
				dp1[i][j] = -1
			if i == 0 or j == m - 1:
				continue
			if mat[i][j] == '*':
				dp1[i][j] = dp1[i - 1][j + 1] + 1
	dp2 = [[0 for i in range(m)] for i in range(n)]
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '.':
				dp2[i][j] = -1
			if i == 0 or j == 0:
				continue
			if mat[i][j] == '*':
				dp2[i][j] = dp2[i - 1][j - 1] + 1
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '.':
				continue
			x = min(dp1[i][j], dp2[i][j])
			if x < k:
				continue
			h.remove((i, j))
			for p in range(1, x + 1):
				if (i - p, j - p) in h:
					h.remove((i - p, j - p))
				if (i - p, j + p) in h:
					h.remove((i - p, j + p))
	if h:
		return False
	return True
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	mat = []
	for l in range(n):
		s = list(input())
		mat.append(s)
	if fun(mat, n, m, k):
		print('Yes')
	else:
		print('No')


import sys
import math
from bisect import bisect_right as br
from itertools import combinations as cb

def int_arr():
	return list(map(int, sys.stdin.readline().strip().split()))

def str_arr():
	return list(map(str, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()

def up(ci, cj, d, ch):
	ti = ci - 1
	tj = cj + 1
	td = d
	x = 0
	temp = []
	flag = 1
	while ti >= 0 and tj < m:
		if td == 0:
			break
		if arr[ti][tj] == '.':
			flag = 0
			break
		temp.append([ti, tj])
		td -= 1
		ti -= 1
		tj += 1
	if flag == 1 and td == 0:
		for i in temp:
			arr[i[0]][i[1]] = 'd'
		for i in ch:
			arr[i[0]][i[1]] = 'd'
for _ in range(int(input())):
	(n, m, k) = int_arr()
	arr = []
	for i in range(n):
		arr.append([j for j in input()])
	for i in range(n):
		for j in range(m):
			ch = []
			if arr[i][j] == '.':
				continue
			ci = i
			cj = j
			d = -1
			while ci < n and cj < m:
				if arr[ci][cj] == '.':
					break
				ch.append([ci, cj])
				d += 1
				if d < k:
					ci += 1
					cj += 1
					continue
				up(ci, cj, d, ch)
				ci += 1
				cj += 1
	flag = 1
	for l in arr:
		for u in l:
			if u == '*':
				print('NO')
				flag = 0
				break
		if flag == 0:
			break
	else:
		print('YES')


import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import *
from collections import defaultdict, deque, Counter
import math, string
from heapq import *
from operator import add
from itertools import accumulate
BUFSIZE = 8192
sys.setrecursionlimit(10 ** 5)

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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')
inf = float('inf')
en = lambda x: list(enumerate(x))
ceil_ = lambda a, b: (a + b - 1) // b
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())

def go(arr, x, y, n, m):
	a = b = x
	c = d = y
	o = p = 0
	while a > -1 and c > -1:
		if arr[a][c] == '*':
			o += 1
		else:
			break
		a -= 1
		c -= 1
	while b > -1 and d < m:
		if arr[b][d] == '*':
			p += 1
		else:
			break
		b -= 1
		d += 1
	return min(o, p)

def solve():
	(n, m, k) = r()
	arr = [input() for _ in ' ' * n]
	k -= 1
	brr = [list('.') * m for _ in ' ' * n]
	for i in range(k, n):
		for j in range(k, m):
			if arr[i][j] == '*':
				x = go(arr, i, j, n, m)
				if x <= k + 1:
					continue
				else:
					a = b = i
					c = d = j
					for _ in ' ' * x:
						brr[a][c] = '*'
						a -= 1
						c -= 1
					for _ in ' ' * x:
						brr[b][d] = '*'
						b -= 1
						d += 1
	brr = [''.join(i) for i in brr]
	print('YES' if arr == brr else 'NO')
for _ in ' ' * ii():
	solve()


def marcar(ls, i, j, n, m, k):
	num = 1
	while num <= i:
		if j - num < 0 or j + num >= m:
			break
		elif ls[i - num][j - num] == '.' or ls[i - num][j + num] == '.':
			break
		else:
			ls[i - num][j - num] = '#'
			ls[i - num][j + num] = '#'
		num += 1
	if num <= k:
		return False
	else:
		return True

def marcardos(ls, i, j, n, m, k):
	num = 1
	while num <= i:
		if j - num < 0 or j + num >= m:
			break
		elif ls[i - num][j - num] == '.' or ls[i - num][j + num] == '.':
			break
		num += 1
	if num > k:
		for num2 in range(1, num, 1):
			ls[i - num2][j - num2] = '#'
			ls[i - num2][j + num2] = '#'
t = int(input())
for q in range(t):
	(n, m, k) = map(int, input().split())
	ls = []
	for i in range(n):
		ls.append(list(input()))
	correcto = True
	for i in range(n - 1, -1, -1):
		for j in range(m):
			if ls[i][j] == '*':
				correcto = marcar(ls, i, j, n, m, k)
				if correcto == False:
					break
			elif ls[i][j] == '#':
				marcardos(ls, i, j, n, m, k)
		if correcto == False:
			break
	if correcto == False:
		print('NO')
	else:
		print('YES')


def shape_len(matr, x, y):
	d = 0
	m = len(matr[0])
	(x, ay, by) = (x - 1, y - 1, y + 1)
	while x >= 0 and ay >= 0 and (by < m) and (matr[x][ay] == '*') and (matr[x][by] == '*'):
		d += 1
		x = x - 1
		ay = ay - 1
		by = by + 1
	return d

def print_shape(matr, x, y, d):
	for i in range(d + 1):
		matr[x - i][y - i] = '*'
		matr[x - i][y + i] = '*'
	return matr

def solve():
	(n, m, k) = [int(x) for x in input().split()]
	lst = []
	for _ in range(n):
		lst.append([e for e in input()])
	result = [['.' for _ in range(m)] for _ in range(n)]
	for i in range(k, n):
		for j in range(k, m):
			if lst[i][j] == '*':
				sz = shape_len(lst, i, j)
				if sz >= k:
					result = print_shape(result, i, j, sz)
	if lst != result:
		print('NO')
	else:
		print('YES')
for _ in range(int(input())):
	solve()


import bisect
import heapq
import math
import collections
import sys
import copy
from functools import reduce
import decimal
from io import BytesIO, IOBase
import os
import itertools
import functools
from types import GeneratorType
sys.setrecursionlimit(10 ** 9)
decimal.getcontext().rounding = decimal.ROUND_HALF_UP
graphDict = collections.defaultdict
queue = collections.deque

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		to = f(*args, **kwargs)
		if stack:
			return to
		else:
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						return to
					to = stack[-1].send(to)
	return wrappedfunc

class Graphs:

	def __init__(self):
		self.graph = graphDict(set)

	def add_edge(self, u, v):
		self.graph[u].add(v)

	def dfs_utility(self, nodes, visited_nodes):
		visited_nodes.add(nodes)
		for neighbour in self.graph[nodes]:
			if neighbour not in visited_nodes:
				self.dfs_utility(neighbour, visited_nodes)

	def dfs(self, node):
		Visited = set()
		self.dfs_utility(i, Visited)

	def bfs(self, node, f_node):
		count = float('inf')
		visited = set()
		level = 0
		if node not in visited:
			queue.append([node, level])
			visited.add(node)
		flag = 0
		while queue:
			parent = queue.popleft()
			if parent[0] == f_node:
				flag = 1
				count = min(count, parent[1])
			level = parent[1] + 1
			for item in self.graph[parent[0]]:
				if item not in visited:
					queue.append([item, level])
					visited.add(item)
		return count if flag else -1
		return False

	def solve(self, in_degree):
		c = 0
		tracker = queue()
		ans = graphDict(lambda : 1)
		for ii in range(n):
			if in_degree[ii + 1] == 0:
				tracker.append(ii + 1)
		while tracker:
			node = tracker.popleft()
			c += 1
			for neighbour in self.graph[node]:
				in_degree[neighbour] -= 1
				if neighbour < node:
					ans[neighbour] = max(ans[neighbour], ans[node] + 1)
				else:
					ans[neighbour] = max(ans[neighbour], ans[node])
				if in_degree[neighbour] == 0:
					tracker.append(neighbour)
		if c != n:
			return False
		else:
			return max(ans.values()) if len(ans.values()) > 0 else 1
		return 'Send Help!!!!'

class Tree:

	def __init__(self, data):
		self.data = data
		self.left = None
		self.right = None

def inorder(node, lis):
	if node:
		inorder(node.left, lis)
		lis.append(node.data)
		inorder(node.right, lis)
	return lis

def leaf_node_sum(root):
	if root is None:
		return 0
	if root.left is None and root.right is None:
		return root.data
	return leaf_node_sum(root.left) + leaf_node_sum(root.right)

def hight(root):
	if root is None:
		return -1
	if root.left is None and root.right is None:
		return 0
	return max(hight(root.left), hight(root.right)) + 1

class UF:

	def __init__(self, N):
		self._id = list(range(N))
		self._count = N
		self._rank = [0] * N

	def find(self, p):
		id = self._id
		while p != id[p]:
			p = id[p]
		return p

	def count(self):
		return self._count

	def connected(self, p, q):
		return self.find(p) == self.find(q)

	def union(self, p, q):
		id = self._id
		rank = self._rank
		i = self.find(p)
		j = self.find(q)
		if i == j:
			return
		self._count -= 1
		if rank[i] < rank[j]:
			id[i] = j
		elif rank[i] > rank[j]:
			id[j] = i
		else:
			id[j] = i
			rank[i] += 1

	def add_roads(self):
		return set(self._id)

	def __str__(self):
		return ' '.join([str(x) for x in self._id])

	def __repr__(self):
		return 'UF(' + str(self) + ')'

def rounding(n):
	return int(decimal.Decimal(f'{n}').to_integral_value())

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), []))

def p_sum(array):
	return list(itertools.accumulate(array))

def diophantine(a: int, b: int, c: int):
	(d, x, y) = extended_gcd(a, b)
	r = c // d
	return (r * x, r * y)

@bootstrap
def extended_gcd(a: int, b: int):
	if b == 0:
		(d, x, y) = (a, 1, 0)
	else:
		(d, p, q) = (yield extended_gcd(b, a % b))
		x = q
		y = p - q * (a // b)
	yield (d, x, y)
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, **kwargs):
		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 inp():
	return sys.stdin.readline().strip()

def map_inp(v_type):
	return map(v_type, inp().split())

def list_inp(v_type):
	return list(map_inp(v_type))
for _ in range(int(inp())):
	(n, m, k) = map_inp(int)
	arr = []
	for i in range(n):
		temp = list(inp())
		arr.append(temp)
	total = 0
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				total += 1
	visited = set()
	new = 0
	flag = 0
	for i in range(n - 1, -1, -1):
		for j in range(m - 1, -1, -1):
			if arr[i][j] == '*':
				(q, w) = (i, j)
				l = 1
				prev = new
				temp = set()
				if w - l >= 0 and w + l < m and (q - l >= 0):
					e = 0
					while arr[q - l][w - l] == '*' and arr[q - l][w + l] == '*':
						if e == 0:
							if (i, j) not in visited:
								new += 1
								visited.add((i, j))
								temp.add((i, j))
							e = 1
						if (q - l, w - l) not in visited:
							new += 1
							visited.add((q - l, w - l))
							temp.add((q - l, w - l))
						if (q - l, w + l) not in visited:
							new += 1
							visited.add((q - l, w + l))
							temp.add((q - l, w + l))
						l += 1
						if w - l >= 0 and w + l < m and (q - l >= 0):
							continue
						else:
							break
					if l - 1 < k and new - prev > 0:
						for item in temp:
							new -= 1
							visited.remove(item)
	if new == total:
		print('YES')
	else:
		print('NO')


def solve():
	(n, m, k) = map(int, input().split())
	l = []
	for i in range(n):
		l.append(list(input()))
	for i in range(k - 1, n):
		for j in range(m):
			if l[i][j] == '*' or l[i][j] == '!':
				h = 1
				uu = 1
				for r in range(i - 1, -1, -1):
					if j + h < m and j - h > -1 and (l[r][j + h] == '*' or l[r][j + h] == '!') and (l[r][j - h] == '*' or l[r][j - h] == '!'):
						uu += 1
						h += 1
					else:
						break
				if uu > k:
					h = 1
					for r in range(i - 1, -1, -1):
						if j + h < m and j - h > -1 and (l[r][j + h] == '*' or l[r][j + h] == '!') and (l[r][j - h] == '*' or l[r][j - h] == '!'):
							l[r][j + h] = '!'
							l[i][j] = '!'
							l[r][j - h] = '!'
							h += 1
						else:
							break
	c = 0
	for ii in l:
		for i in ii:
			if i == '*':
				c = 1
				break
	if c == 0:
		print('YES')
	else:
		print('NO')
t = int(input())
while t:
	solve()
	t -= 1


import sys
import math
import collections
dy = [1, 0, -1, 0]
dx = [0, 1, 0, -1]
r = sys.stdin.readline
for _ in range(int(r())):
	(N, M, K) = map(int, r().split())
	L = []
	for _ in range(N):
		L.append(list(r().rstrip()))
	visited = [[0] * (M + 1) for _ in range(N + 1)]
	for i in range(N):
		for j in range(M):
			cnt = 1
			if L[i][j] == '*':
				visited[i][j] = 1
			else:
				continue
			while 1:
				if i - cnt >= 0 and j + cnt < M and (j - cnt >= 0):
					if L[i - cnt][j + cnt] == L[i - cnt][j - cnt] == '*':
						cnt += 1
					else:
						break
				else:
					break
			cnt -= 1
			if cnt >= K:
				visited[i][j] = 0
				for k in range(1, cnt + 1):
					visited[i - k][j + k] = visited[i - k][j - k] = 0
	ans = 0
	for i in visited:
		ans += sum(i)
	if ans:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, lim) = map(int, input().split())
	mat = []
	test = []
	for i in range(n):
		s = input()
		row = []
		for j in range(m):
			if s[j] == '*':
				row.append(1)
			else:
				row.append(0)
		mat.append(row)
		test.append([0] * m)
	for i in range(n):
		for j in range(m):
			if mat[i][j] == 0:
				continue
			count = 1
			while 1:
				x = i - count
				y1 = j + count
				y2 = j - count
				if 0 <= x < n and 0 <= y1 < m and (0 <= y2 < m):
					if mat[x][y1] == 1 and mat[x][y2] == 1:
						pass
					else:
						break
				else:
					break
				count += 1
			if count >= lim + 1:
				for k in range(count):
					x = i - k
					y1 = j - k
					y2 = j + k
					test[x][y1] = 1
					test[x][y2] = 1
	flag = True
	for i in range(n):
		for j in range(m):
			if mat[i][j] != test[i][j]:
				flag = False
	if flag:
		print('YES')
	else:
		print('NO')


import sys
from bisect import bisect_right as lb
from collections import deque
from queue import PriorityQueue as pq
from math import gcd
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
lii = lambda : list(map(int, list(ip())))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
for _ in range(ii()):
	(n, m, k) = il()
	a = []
	for i in range(n):
		a.append(list(ip()))
	vis = [[0 for i in range(m)] for j in range(n)]
	fl = 1
	for i in range(n - 1, -1, -1):
		for j in range(m - 1, -1, -1):
			if a[i][j] == '.':
				continue
			k1 = i
			k2 = j
			d = 0
			while k1 - d >= 0 and k2 - d >= 0 and (k2 + d < m) and (a[k1 - d][k2 - d] == '*') and (a[k1 - d][k2 + d] == '*'):
				d += 1
			d -= 1
			if d < k and vis[i][j] == 0:
				fl = 0
				break
			if d < k:
				continue
			for mn in range(d + 1):
				vis[k1 - mn][k2 - mn] = 1
				vis[k1 - mn][k2 + mn] = 1
		if fl == 0:
			break
	for i in range(n):
		for j in range(m):
			if a[i][j] == '.':
				continue
			if vis[i][j] == 0:
				fl = 0
	if fl == 1:
		print('YES')
	else:
		print('NO')


def check(i, j, k, matrix):
	n = len(matrix)
	m = len(matrix[0])
	d = 0
	while i + d < n and j + d < m and (j - d > -1):
		if matrix[i + d][j + d] == matrix[i + d][j - d]:
			if matrix[i + d][j + d]:
				d += 1
			else:
				break
		else:
			break
	d -= 1
	return d if d >= k else -1

def main():
	(n, m, k) = map(int, input().split())
	matrix = [[0] * m for _ in range(n)]
	checked = [[0] * m for _ in range(n)]
	for i in range(n):
		s = input()
		for (j, c) in enumerate(s):
			if c == '*':
				checked[i][j] = matrix[i][j] = 1
	matrix.reverse()
	checked.reverse()
	for i in range(n):
		for j in range(m):
			if matrix[i][j]:
				d = check(i, j, k, matrix)
				while d > -1:
					checked[i + d][j + d] = checked[i + d][j - d] = 0
					d -= 1
	for i in range(n):
		for j in range(m):
			if checked[i][j]:
				return False
	return True
for _ in range(int(input())):
	print('YES' if main() else 'NO')


intput = lambda : map(int, input().split())

def process(r, c, K, g, s):
	seen = {(r, c)}
	(i, j) = (r - 1, c - 1)
	(k, l) = (r - 1, c + 1)
	size = 0
	while g[i][j] == g[k][l] == '*':
		size += 1
		seen.add((i, j))
		seen.add((k, l))
		(i, j) = (i - 1, j - 1)
		(k, l) = (k - 1, l + 1)
	if size >= K:
		s |= seen

def solve():
	marks = 0
	ticks = []
	seen = set()
	(n, m, k) = intput()
	grid = ['.' * (m + 2)]
	grid += ['.' + input() + '.' for _ in range(n)]
	grid += ['.' * (m + 2)]
	for r in range(1, n + 1):
		for c in range(1, m + 1):
			if grid[r][c] != '*':
				continue
			marks += 1
			if grid[r - 1][c - 1] == '.':
				continue
			if grid[r - 1][c + 1] == '.':
				continue
			process(r, c, k, grid, seen)
	return 'YES' if len(seen) == marks else 'NO'
(t,) = intput()
for i in range(t):
	print(solve())


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	matrix = []
	for j in range(n):
		l = input()
		matrix.append(list(l))
	checker = [[True for _ in range(m)] for j in range(n)]
	ans = 'Yes'
	for i in range(n):
		for j in range(m):
			if matrix[i][j] == '*':
				checker[i][j] = False
	for i in range(k, n):
		for j in range(k, m):
			cur = []
			if matrix[i][j] == '*':
				cur.append((i, j))
				curi = i
				curj = j
				curcnt = 0
				curj1 = j
				while True:
					if curi <= 0:
						break
					if curj <= 0:
						break
					if curj1 + 1 >= m:
						break
					if matrix[curi - 1][curj - 1] == '*' and matrix[curi - 1][curj1 + 1] == '*':
						cur.append((curi - 1, curj - 1))
						cur.append((curi - 1, curj1 + 1))
						curcnt += 1
						curi -= 1
						curj -= 1
						curj1 += 1
					else:
						break
				if curcnt >= k:
					for i1 in cur:
						checker[i1[0]][i1[1]] = True
	for i in range(n):
		for j in range(m):
			if checker[i][j] == False:
				ans = 'No'
				break
	print(ans)


import os
import sys
from io import BytesIO, IOBase
_str = str
str = lambda x=b'': x if type(x) is bytes else _str(x).encode()
BUFSIZE = 8192

def istick(l, i, j, k, n, m):
	(lx, rx) = (j, j)
	t = 0
	for y in range(i, -1, -1):
		if lx >= 0 and rx < m and (l[y][lx] == l[y][rx] == '*'):
			t += 1
			lx -= 1
			rx += 1
		else:
			break
	if t > k:
		return t
	return False

def marktick(d, i, j, x, n, m):
	l = d
	(lx, rx) = (j, j)
	t = 0
	for y in range(i, i - x, -1):
		if lx >= 0 and rx < m:
			l[y][lx] = '*'
			l[y][rx] = '*'
			lx -= 1
			rx += 1

def main():
	for _ in range(int(input())):
		(n, m, k) = list(map(int, input().split()))
		l = [list(input()) for i in range(n)]
		d = [['.' for i in range(m)] for i in range(n)]
		for i in range(n):
			for j in range(m):
				x = istick(l, i, j, k, n, m)
				if x:
					marktick(d, i, j, x, n, m)
		if d == l:
			print('YES')
		else:
			print('NO')
main()

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')


import sys
input = sys.stdin.readline

def myfun(a, visited, n, m):
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*' and visited[i][j] == False:
				return False
			elif a[i][j] == '.' and visited[i][j] == True:
				return False
	return True

def main():
	(n, m, k) = map(int, input().split())
	a = []
	visited = []
	for _ in range(n):
		a.append(input())
		visited.append([False] * m)
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*':
				(k1, k2, k3, k4) = (i, j, j, -1)
				while k1 >= 0 and k2 >= 0 and (k3 <= m):
					if a[k1][k2] == '*' and a[k1][k3] == '*':
						k4 += 1
					else:
						break
					(k1, k2, k3) = (k1 - 1, k2 - 1, k3 + 1)
				if k4 >= k:
					(k1, k2, k3) = (i, j, j)
					while k1 >= 0 and k2 >= 0 and (k3 <= m):
						if a[k1][k2] == '*' and a[k1][k3] == '*':
							visited[k1][k2] = True
							visited[k1][k3] = True
						else:
							break
						(k1, k2, k3) = (k1 - 1, k2 - 1, k3 + 1)
	if myfun(a, visited, n, m):
		print('YES')
	else:
		print('NO')
for _t in range(int(input())):
	main()


t = int(input())

def check(arr, ans, m, i, j, k):
	a = i - 1
	b = j - 1
	d = j + 1
	size = 0
	while a >= 0 and b >= 0 and (d < m):
		if arr[a][b] == '*' and arr[a][d] == '*':
			size += 1
			a -= 1
			b -= 1
			d += 1
		else:
			break
	if size >= k:
		ans[i][j] = '*'
		a = i - 1
		b = j - 1
		d = j + 1
		while size > 0 and a >= 0 and (b >= 0) and (d < m):
			size -= 1
			ans[a][b] = '*'
			ans[a][d] = '*'
			a -= 1
			b -= 1
			d += 1

def solve():
	(n, m, k) = map(int, input().split())
	lst = []
	for i in range(n):
		lst += [input()]
	ans = [['.' for i in range(m)] for i in range(n)]
	for i in range(n):
		for j in range(m):
			if lst[i][j] == '*':
				check(lst, ans, m, i, j, k)
	w = 0
	for i in range(n):
		for j in range(m):
			if lst[i][j] == '*':
				if ans[i][j] != '*':
					w = 1
					break
		if w == 1:
			break
	if w == 1:
		print('NO')
	else:
		print('YES')
while t:
	solve()
	t -= 1


from sys import stdin
inp = stdin.readline
t = int(inp())
for _ in range(t):
	(n, m, k) = map(int, inp().split())
	arr = []
	done = 0
	for _ in range(n):
		s = inp().strip()
		arr.append([c for c in s])
	for i in range(n - 1, k - 1, -1):
		for (p, c) in enumerate(arr[i]):
			if c == '*':
				for j in range(1, i + 1):
					if p - j >= 0 and p + j < m:
						if arr[i - j][p - j] in {'*', '!'} and arr[i - j][p + j] in {'*', '!'}:
							arr[i - j][p - j] = '!'
							arr[i - j][p + j] = '!'
						elif j <= k:
							done = 1
							break
						else:
							break
					elif j <= k:
						done = 1
						break
			elif c == '!':
				for j in range(1, i + 1):
					if p - j >= 0 and p + j < m:
						if arr[i - j][p - j] in {'*', '!'} and arr[i - j][p + j] in {'*', '!'}:
							if j >= k and (j == i or p - j == 0 or p + j + 1 == m):
								for a in range(1, j + 1):
									arr[i - a][p - a] = '!'
									arr[i - a][p + a] = '!'
								break
						elif j > k:
							for a in range(1, j + 1):
								arr[i - a][p - a] = '!'
								arr[i - a][p + a] = '!'
							break
						else:
							break
			if done:
				break
		if done:
			break
	for i in range(k):
		if arr[i].count('*') > 0:
			done = 1
	if done:
		print('NO')
	else:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
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')
BLACK = '*'
WHITE = '.'

def solve():
	(n, m, k) = map(int, input().split())
	B = [list(input().strip()) for _ in range(n)]
	ok = [[False] * m for _ in range(n)]

	def find_largest(i, j):
		ans = -1
		x = i
		y0 = j
		y1 = j
		while 0 <= x < n and 0 <= y0 and (y1 < m) and (B[x][y0] == B[x][y1] == BLACK):
			ans += 1
			y0 -= 1
			y1 += 1
			x -= 1
		return ans
	for i in range(n):
		for j in range(m):
			if B[i][j] == BLACK:
				x = find_largest(i, j)
				if x >= k:
					ok[i][j] = True
					for l in range(1, x + 1):
						ok[i - l][j + l] = ok[i - l][j - l] = True
	for i in range(n):
		for j in range(m):
			if B[i][j] == BLACK and (not ok[i][j]):
				print('NO')
				return
	print('YES')
	return
for nt in range(int(input())):
	solve()


import sys
from math import factorial, gcd
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest, nsmallest
from itertools import groupby, accumulate
from copy import deepcopy
MOD = 10 ** 9 + 7
INF = float('inf')
input = sys.stdin.readline
rl = lambda : list(map(int, input().split()))
rs = lambda : sys.stdin.readline().strip()

def visit(i, j):
	visited = set()
	temp = set()
	temp.add((i, j))
	t = k
	while i + 1 < n and j + 1 < m and (t > 0):
		(i, j) = (i + 1, j + 1)
		if grid[i][j] == '.':
			break
		temp.add((i, j))
		t -= 1
	if t != 0:
		return set()
	t = k
	while i < n and j < m and (grid[i][j] == '*'):
		res = check(i, j, t)
		temp.add((i, j))
		if res:
			visited |= res
			visited |= temp
		t += 1
		(i, j) = (i + 1, j + 1)
	return visited

def check(i, j, t):
	v = set()
	while i > 0 and j + 1 < m and (t > 0):
		(i, j) = (i - 1, j + 1)
		if grid[i][j] == '.':
			break
		v.add((i, j))
		t -= 1
	if t == 0:
		return v
	else:
		return set()
for _ in range(int(input())):
	(n, m, k) = rl()
	grid = [rs() for _ in range(n)]
	possible = set()
	flag = True
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '.':
				continue
			possible |= visit(i, j)
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*' and (i, j) not in possible:
				flag = False
				break
		if not flag:
			break
	print('YES') if flag else print('NO')


import math
from collections import Counter, defaultdict
from functools import lru_cache

def check(r, c, matrix):
	count = 0
	(r1, c1) = (r, c)
	start = 1
	while True:
		if 0 <= r - start < n and 0 <= c + start < m and (0 <= c - start < m):
			if matrix[r - start][c - start] in ['*', -1] and matrix[r - start][c + start] in ['*', -1]:
				count += 1
				start += 1
			else:
				break
		else:
			break
	if count >= k:
		(r, c) = (r1, c1)
		start = 1
		matrix[r][c] = -1
		while True:
			if 0 <= r - start < n and 0 <= c + start < m and (0 <= c - start < m):
				if matrix[r - start][c - start] in ['*', -1] and matrix[r - start][c + start] in ['*', -1]:
					matrix[r - start][c - start] = -1
					matrix[r - start][c + start] = -1
					start += 1
				else:
					break
			else:
				break
t = int(input())
for _ in range(t):
	(n, m, k) = [int(i) for i in input().split()]
	matrix = []
	for i in range(n):
		matrix.append([i for i in input()])
	for i in range(k, n):
		for j in range(k, m - k + 1):
			if matrix[i][j] == '*':
				check(i, j, matrix)
	ans = 'YES'
	for i in range(n):
		for j in range(m):
			if matrix[i][j] == '*':
				ans = 'NO'
				break
	print(ans)


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	t = []
	for i in range(n):
		t.append(list(input()))
	ma = {}
	h = 0
	for i in range(n - 1, -1, -1):
		for j in range(m):
			if t[i][j] == '*':
				po = [(i, j)]
				high = 0
				piche = j - 1
				aage = j + 1
				for up in range(i - 1, -1, -1):
					if piche < 0 or aage > m - 1:
						break
					if t[up][piche] == '*' and t[up][aage] == '*':
						high += 1
						po.append((up, piche))
						po.append((up, aage))
						piche -= 1
						aage += 1
					else:
						break
				if high >= k:
					for x in po:
						ma[x] = 1
				elif (i, j) in ma:
					continue
				else:
					print('NO')
					h += 1
					break
		if h > 0:
			break
	if h == 0:
		print('YES')


I = input
for _ in [0] * int(I()):
	(n, m, k) = map(int, I().split())
	(*a,) = ''.join((I() for _ in [0] * n))
	n *= m
	f = 0
	while n:
		i = j = n = n - 1
		l = 0
		while l <= min(n % m, m - n % m - 1, n // m) and a[i] < '.' > a[j]:
			i -= m + 1
			j -= m - 1
			l += 1
		if l > k:
			while l:
				l -= 1
				j += m - 1
				i += m + 1
				a[i] = a[j] = '#'
		else:
			f |= a[n] == '*'
	print('YNEOS'[f::2])


from sys import stdin
input = stdin.readline

def find(x, y):
	val = 1
	while y - val >= 0 and y + val < m and (x - val >= 0):
		if mat[x - val][y - val] == '*' and mat[x - val][y + val] == '*':
			val += 1
		else:
			break
	return val - 1

def mark(x, y, val):
	for i in range(val + 1):
		visited[x - i][y - i] = 0
		visited[x - i][y + i] = 0
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	(mat, visited) = ([], [])
	for i in range(n):
		l = list(input())
		mat.append(l)
		visited.append([1 if x == '*' else 0 for x in l])
	for i in range(k, n):
		for j in range(k, m - k):
			if mat[i][j] == '*':
				x = find(i, j)
				if x >= k:
					mark(i, j, x)
	s = 0
	for i in visited:
		s += sum(i)
	print('NO' if s > 0 else 'YES')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	b = []
	for r in range(n):
		b.append(input())
	tst = [['.' for c in range(m)] for r in range(n)]
	for rr in range(n):
		for cc in range(m):
			if b[rr][cc] != '*':
				continue
			dright = dleft = 0
			r = rr
			c = cc
			while r - 1 >= 0 and c - 1 >= 0:
				if b[r - 1][c - 1] == '*':
					dleft += 1
					r -= 1
					c -= 1
				else:
					break
			r = rr
			c = cc
			while r - 1 >= 0 and c + 1 < m:
				if b[r - 1][c + 1] == '*':
					dright += 1
					r -= 1
					c += 1
				else:
					break
			d = min(dright, dleft)
			if d >= k:
				lcnt = 0
				while lcnt <= d:
					tst[rr - lcnt][cc - lcnt] = '*'
					lcnt += 1
				rcnt = 0
				while rcnt <= d:
					tst[rr - rcnt][cc + rcnt] = '*'
					rcnt += 1
	same = True
	for r in range(n):
		if not same:
			break
		for c in range(m):
			if b[r][c] != tst[r][c]:
				same = False
				break
	if same:
		print('YES')
	else:
		print('NO')


def center(ci, cj):
	d = 0
	p1 = (ci - 1, cj - 1)
	p2 = (ci - 1, cj + 1)
	s = set()
	s.add((ci, cj))
	while p1[0] >= 0 and p1[1] >= 0 and (p2[1] < m):
		if mp[p1[0]][p1[1]] == '*' and mp[p2[0]][p2[1]] == '*':
			d += 1
			s.add(p1)
			s.add(p2)
			p1 = (p1[0] - 1, p1[1] - 1)
			p2 = (p2[0] - 1, p2[1] + 1)
		else:
			break
	if d >= k:
		return s
	else:
		return set()
for _ in range(int(input())):
	(n, m, k) = tuple(map(int, input().split()))
	mp = []
	for __ in range(n):
		mp.append(input().strip())
	tick = [[False for j in range(m)] for i in range(n)]
	valid_set = set()
	given_set = set()
	for i in range(n):
		for j in range(m):
			if mp[i][j] == '*':
				given_set.add((i, j))
				ss = center(i, j)
				if len(ss) > 0:
					valid_set.update(ss)
	if len(valid_set) == len(given_set):
		print('yes')
	else:
		print('no')


def max_k(arr, x, y, n, m):
	(i, j1, j2) = (x, y, y)
	k = 0
	while 0 <= i - k < n and 0 <= j1 - k < m and (0 <= j2 + k < m) and (arr[i - k][j1 - k] == '*') and (arr[i - k][j2 + k] == '*'):
		k += 1
	return k - 1

def solve():
	(n, m, k) = map(int, input().split())
	a = []
	for i in range(n):
		a.append(input())
	colored = [[0 for j in range(m)] for i in range(n)]
	for i in range(n):
		for j in range(m):
			if a[i][j] == '.':
				continue
			mk = max_k(a, i, j, n, m)
			if mk < k:
				continue
			for delta in range(mk + 1):
				colored[i - delta][j - delta] = 1
				colored[i - delta][j + delta] = 1
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*' and (not colored[i][j]):
				print('NO')
				return
	print('YES')

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


from sys import stdin, stdout, setrecursionlimit
from io import BytesIO, IOBase
from heapq import *
from collections import Counter, deque
setrecursionlimit(10000)

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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
		self.BUFSIZE = 8192

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

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

	def flush(self):
		if self.writable:
			self.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')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
input = lambda : stdin.readline().rstrip('\r\n')
inp = lambda : int(input())
st = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
int_arr = lambda : list(map(int, input().strip().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().strip().split())
get_int = lambda : map(int, input().strip().split())
get_float = lambda : map(float, input().strip().split())
mod = 1000000007
for _ in range(inp()):
	(n, m, l) = get_int()
	arr = []
	for i in range(n):
		s = list(st())
		arr.append(s)
	dp1 = [[0 for i in range(m)] for j in range(n)]
	dp2 = [[0 for i in range(m)] for j in range(n)]
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				dp1[i][j] = 1
				dp2[i][j] = 1
				if i > 0 and j > 0:
					dp1[i][j] += dp1[i - 1][j - 1]
				if i > 0 and j < m - 1:
					dp2[i][j] += dp2[i - 1][j + 1]
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				val = min(dp1[i][j], dp2[i][j])
				if val > l:
					(ind1, ind2, ind3) = (i, j, j)
					while val:
						arr[ind1][ind2] = '.'
						arr[ind1][ind3] = '.'
						ind1 -= 1
						ind2 -= 1
						ind3 += 1
						val -= 1
	cond = True
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				cond = False
				break
	print('YES' if cond else 'NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	s = [list(input().rstrip()) for _ in range(n)]
	for i in range(k, n):
		for j in range(k, m - k):
			if s[i][j] == '.':
				continue
			c1 = 0
			(i0, j0) = (i - 1, j - 1)
			while 0 <= i0 < n and 0 <= j0 < m:
				if not s[i0][j0] == '.':
					c1 += 1
				else:
					break
				i0 -= 1
				j0 -= 1
			c2 = 0
			(i0, j0) = (i - 1, j + 1)
			while 0 <= i0 < n and 0 <= j0 < m:
				if not s[i0][j0] == '.':
					c2 += 1
				else:
					break
				i0 -= 1
				j0 += 1
			c = min(c1, c2)
			if c >= k:
				s[i][j] = '@'
				(i0, j0) = (i - 1, j - 1)
				for _ in range(c):
					s[i0][j0] = '@'
					i0 -= 1
					j0 -= 1
				(i0, j0) = (i - 1, j + 1)
				for _ in range(c):
					s[i0][j0] = '@'
					i0 -= 1
					j0 += 1
	ans = 'YES'
	for i in range(n):
		for j in range(m):
			if s[i][j] == '*':
				ans = 'NO'
				break
		if ans == 'NO':
			break
	print(ans)


import os, sys
from io import BytesIO, IOBase
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))
try:
	(sys.stdin, sys.stdout, sys.stderr) = (open('input.txt', 'r'), open('output.txt', 'w'), open('error.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
MOD = 1000000007
from collections import *
import bisect
from heapq import *

def solve():
	(n, m, k) = iia()
	vis = [[0 for i in range(m)] for i in range(n)]
	tmp = []
	for i in range(n):
		tmp.append(is1())
	for i in range(n - 1, -1, -1):
		for j in range(m):
			if tmp[i][j] == '*':
				l = 0
				a1 = i - 1
				l1 = j - 1
				l2 = j + 1
				v = []
				while a1 >= 0 and l1 >= 0 and (l2 < m):
					if tmp[a1][l1] == '*' and tmp[a1][l2] == '*':
						l += 1
						v.append((a1, l1))
						v.append((a1, l2))
						l1 -= 1
						l2 += 1
						a1 -= 1
						continue
					break
				if l < k and vis[i][j] == 0:
					print('NO')
					return
				if l >= k:
					while v:
						t = v.pop()
						vis[t[0]][t[1]] = 1
				vis[i][j] = 1
	for i in range(n):
		for j in range(m):
			if tmp[i][j] == '*' and vis[i][j] == 0:
				print('NO')
				return
	print('YES')
	return
for _ in range(ii1()):
	solve()


import os
import sys
from io import BytesIO, IOBase

def solve():
	(n, m, k) = map(int, input().split())
	a = [list(input().rstrip()) for _ in range(n)]
	vis = [[0] * m for _ in range(n)]
	for i in range(n - 1, -1, -1):
		for j in range(m - 1, -1, -1):
			if a[i][j] == '*':
				(z, u, v, y, temp) = (0, i - 1, j - 1, j + 1, [])
				while u > -1 and v > -1 and (y < m) and (a[u][v] == '*') and (a[u][y] == '*'):
					vis[u][v] += 1
					vis[u][y] += 1
					temp.extend([(u, y), (u, v)])
					(z, u, v, y) = (z + 1, u - 1, v - 1, y + 1)
				if z < k:
					for (p, q) in temp:
						vis[p][q] -= 1
				else:
					vis[i][j] = 1
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*' and vis[i][j] == 0:
				return 'NO'
	return 'YES'

def main():
	for _ in range(int(input())):
		print(solve())
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')
main()


from collections import deque
import heapq
from math import sqrt
import operator
from operator import itemgetter
import sys
import copy
inf_var = 0
if inf_var == 1:
	inf = open('input.txt', 'r')
else:
	inf = sys.stdin
input = inf.readline

def read_one_int():
	return int(input().rstrip('\n'))

def read_one_float():
	return float(input().rstrip('\n'))

def read_list_of_ints():
	res = [int(val) for val in input().rstrip('\n').split()]
	return res

def read_list_of_ints_zero():
	return [int(val) - 1 for val in input().rstrip('\n').split()]

def read_str():
	return input().rstrip()

def count_height(i, j, field, k):
	height = 0
	res = set()
	res.add((i, j))
	w1 = j
	w2 = j
	for h in range(i - 1, -1, -1):
		w1 -= 1
		w2 += 1
		if w1 >= 0 and w2 < len(field[0]):
			if field[h][w1] == '*' and field[h][w2] == '*':
				height += 1
				res.add((h, w1))
				res.add((h, w2))
			else:
				break
		else:
			break
	if height >= k:
		return res
	else:
		return None

def main():
	tests = read_one_int()
	for _ in range(tests):
		(n, m, k) = read_list_of_ints()
		field = []
		painted = set()
		tick_cells = set()
		for i in range(n):
			field.append(read_str())
			for j in range(m):
				if field[-1][j] == '*':
					painted.add((i, j))
		for i in range(n - 1, -1, -1):
			for j in range(m):
				if field[i][j] == '.':
					continue
				cur_tick = count_height(i, j, field, k)
				if cur_tick is not None:
					tick_cells.update(cur_tick)
		if painted == tick_cells:
			print('YES')
		else:
			print('NO')
main()


import sys

def rall():
	return sys.stdin.readlines()

def rl():
	return sys.stdin.readline().strip()

def rl_types(types):
	str_list = [x for x in sys.stdin.readline().strip().split(' ')]
	return [types[i](str_list[i]) for i in range(len(str_list))]

def pr(something=''):
	sys.stdout.write(str(something) + '\n')

def pra(array):
	sys.stdout.write(' '.join([str(x) for x in array]) + '\n')

def solve(array):
	return array
NT = int(rl())
for _ in range(NT):
	(n, m, k) = map(int, rl().split(' '))
	grid = []
	for _ in range(n):
		row = [1 if c == '*' else 0 for c in rl()]
		grid.append(row)
	needs = set()
	for r in range(n):
		for c in range(m):
			if grid[r][c] == 1:
				needs.add((r, c))
	len_neg = [[x for x in row] for row in grid]
	len_pos = [[x for x in row] for row in grid]
	min_tick = [[0] * m for _ in range(n)]
	can_cover = set()
	feasible = True
	for r in range(1, n):
		row = grid[r]
		for c in range(1, m - 1):
			if row[c] == 0:
				pass
			else:
				len_neg[r][c] = len_neg[r - 1][c - 1] + 1
				len_pos[r][c] = len_pos[r - 1][c + 1] + 1
				minsize = min(len_neg[r][c], len_pos[r][c])
				if minsize > k:
					min_tick[r][c] = minsize
					can_cover.add((r, c))
					for o in range(1, minsize):
						if r - o >= 0:
							if c - o >= 0:
								can_cover.add((r - o, c - o))
							if c + o < m:
								can_cover.add((r - o, c + o))
	print('YES' if len(needs - can_cover) == 0 else 'NO')


def f(i, j, k):
	if x[i][j] == '.':
		return
	p = i
	c = 0
	z = [[i, j]]
	(a, b) = (j - 1, j + 1)
	i -= 1
	while i >= 0 and a >= 0 and (b < len(x[0])):
		if x[i][a] == '*' and x[i][b] == '*':
			c += 1
			z.append([i, a])
			z.append([i, b])
		else:
			break
		i -= 1
		a -= 1
		b += 1
	if c >= k:
		for i in z:
			v[i[0]][i[1]] = 1
	return
for t in range(int(input())):
	(n, m, k) = map(int, input().split())
	v = []
	x = []
	for i in range(n):
		v.append([0] * m)
		x.append(list(input()))
	for i in range(n):
		for j in range(m):
			f(i, j, k)
	R = True
	for i in range(n):
		for j in range(m):
			if v[i][j] != 1 and x[i][j] == '*':
				R = False
	if R:
		print('YES')
	else:
		print('NO')


import copy
t = int(input())
for _ in range(t):
	(n, m, k) = list(map(int, input().split()))
	ls = [list(input()) for _ in range(n)]
	lc = copy.deepcopy(ls)
	for i in range(n):
		for j in range(m):
			if ls[i][j] == '*':
				f = True
				for d in range(k + 1):
					if i - d < 0 or j + d >= m or j - d < 0 or (ls[i - d][j + d] != ls[i - d][j - d]) or (ls[i - d][j - d] != '*'):
						f = False
						break
				if f:
					lc[i][j] = '.'
					for d in range(1, n):
						if (i - d >= 0 and j + d < m and (ls[i - d + 1][j + d - 1] == '*') and (ls[i - d][j + d] == '*')) and (i - d >= 0 and j - d >= 0 and (ls[i - d + 1][j - d + 1] == '*') and (ls[i - d][j - d] == '*')):
							lc[i - d][j + d] = '.'
							lc[i - d][j - d] = '.'
						else:
							break
	ans = True
	for i in range(n):
		for j in range(m):
			if lc[i][j] != '.':
				ans = False
				break
	if ans:
		print('YES')
	else:
		print('NO')


def draw(c, k):
	l = [['.'] * m for i in range(n)]
	for i in range(n):
		for j in range(m):
			if c[i][j] >= k:
				l[i][j] = '*'
				for z in range(1, c[i][j] + 1):
					l[i - z][j - z] = '*'
					l[i - z][j + z] = '*'
	return l

def comp(l, l1):
	return l == l1
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	l = [list(input()) for i in range(n)]
	a = [[0 for j in range(m)] for i in range(n)]
	b = [[0 for j in range(m)] for i in range(n)]
	c = [[0 for j in range(m)] for i in range(n)]
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*' and i > 0 and (j > 0):
				a[i][j] = a[i - 1][j - 1] + 1
				if l[i - 1][j - 1] == '.':
					a[i][j] = 0
			if l[i][j] == '*' and i > 0 and (j < m - 1):
				b[i][j] = b[i - 1][j + 1] + 1
				if l[i - 1][j + 1] == '.':
					b[i][j] = 0
			c[i][j] = min(a[i][j], b[i][j])
	l1 = draw(c, k)
	if comp(l, l1):
		print('YES')
	else:
		print('NO')


import sys
N = int(200000.0 + 5)
sys.setrecursionlimit(N)

def charming():
	(n, m, k) = map(int, input().split())
	s = list((list() for i in range(n + 1)))
	ok = list(([0] * (m + 1) for i in range(n + 1)))
	for i in range(1, n + 1):
		s[i] = '#' + input()
	for i in range(k, n + 1):
		for j in range(i + 1, n + 1):
			for k in range(i + 1, m - i + 1):
				flag = True
				for h in range(i + 1):
					if s[j - h][k - h] != '*' or s[j - h][k + h] != '*':
						flag = False
						break
				if flag == False:
					continue
				for h in range(i + 1):
					ok[j - h][k - h] = 1
					ok[j - h][k + h] = 1
	for i in range(1, n + 1):
		for j in range(1, m + 1):
			if ok[i][j] == 0 and s[i][j] == '*':
				print('NO')
				return
	print('YES')
for t in range(int(input())):
	charming()


from itertools import repeat

def line():
	return map(int, input().split())
t = int(input())
for _ in repeat(None, t):
	(n, m, k) = line()
	board = [{i for (i, c) in enumerate(input()) if c == '*'} for _ in repeat(None, n)]
	covered = [set() for _ in repeat(None, n)]
	for i in range(n):
		for j in range(m):
			cs = []
			for d in range(i + 1):
				x = {j - d, j + d}
				l = board[i - d]
				if not x.issubset(l):
					d -= 1
					break
				cs.append(x)
			if d >= k:
				for (h, cl) in enumerate(cs):
					covered[i - h].update(cl)
	if all((l.issubset(cs) for (l, cs) in zip(board, covered))):
		print('yes')
	else:
		print('no')


import sys
input = sys.stdin.readline

def solve():
	(n, m, k) = map(int, input().split())
	a = [list(input().strip()) for i in range(n)]
	b = [['.'] * m for i in range(n)]
	for x in range(n):
		for y in range(m):
			if a[x][y] == '*':
				d = 0
				for i in range(1, x + 1):
					if y - i >= 0 and y + i < m and (a[x - i][y - i] == '*') and (a[x - i][y + i] == '*'):
						d = i
					else:
						break
				if d >= k:
					for i in range(d + 1):
						b[x - i][y - i] = '*'
						b[x - i][y + i] = '*'
	print(['NO', 'YES'][a == b])
for i in range(int(input())):
	solve()


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	matrix = [list(input()) for _ in range(n)]
	clr = [[0 for _ in range(m)] for _ in range(n)]
	for i in range(n):
		for j in range(m):
			flag = True
			for d in range(k, min(i, j, m - j - 1) + 1):
				for h in range(0, d + 1):
					if matrix[i - h][j + h] != '*' or matrix[i - h][j - h] != '*':
						flag = False
				if flag:
					for h in range(0, d + 1):
						(clr[i - h][j - h], clr[i - h][j + h]) = (1, 1)
	print('YES' if all((all(((matrix[i][j] == '*') == clr[i][j] for j in range(m))) for i in range(n))) else 'NO')


import sys
import math
from math import factorial, inf, gcd, sqrt
from heapq import *
from functools import *
from itertools import *
from collections import *
from typing import *
from bisect import *
import random
from sys import stdin, stdout
sys.setrecursionlimit(10 ** 5)

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def mp():
	return map(int, inp().split())

def lmp():
	return list(mp())
t = iinp()
for i in range(t):
	(m, n, k) = mp()
	a = [list(inp()) for i in range(m)]
	for i in range(m):
		for j in range(n):
			if a[i][j] != '.':
				ok = 0
				while 0 <= i - ok < m and 0 <= j - ok < n and (0 <= j + ok < n) and (a[i - ok][j - ok] != '.') and (a[i - ok][j + ok] != '.'):
					ok += 1
				if ok > k:
					for t in range(ok):
						a[i - t][j - t] = a[i - t][j + t] = '#'
	print('YES' if all((j != '*' for i in a for j in i)) else 'NO')


tests = int(input())
for _ in range(0, tests):
	(n, m, k) = map(int, input().split())
	arr = []
	inds = []
	final = []
	for _ in range(0, n):
		i = input()
		for j in range(0, m):
			if i[j] == '*':
				inds.append([_, j])
		arr.append(i)
	for i in range(n - 1, k - 1, -1):
		for j in range(0, m):
			if arr[i][j] == '*':
				a = 1
				b = 1
				count = 0
				new = []
				while i - a >= 0 and j - b >= 0 and (j + b <= m - 1):
					if arr[i - a][j - b] == '*' and arr[i - a][j + b] == '*':
						new.append([i - a, j - b])
						new.append([i - a, j + b])
						a += 1
						b += 1
						count += 1
					else:
						break
				if count >= k:
					if [i, j] not in final:
						final.append([i, j])
					for pp in new:
						if pp not in final:
							final.append(pp)
	if final != []:
		for i in final:
			if i in inds:
				val = True
			else:
				val = False
				break
		if val and len(final) == len(inds):
			print('YEs')
		else:
			print('NO')
	elif final == [] and inds == []:
		print('YES')
	else:
		print('NO')


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def get_int():
	return int(sys.stdin.readline().strip())

def get_list_strings():
	return list(map(str, sys.stdin.readline().strip().split()))

def solve(n, m, k, arr):
	store = {}
	row = n - 1
	while row >= 0:
		for i in range(m):
			if arr[row][i] == '.':
				continue
			leftTravel = 0
			tRow = row - 1
			tCol = i - 1
			while (tRow >= 0 and tCol >= 0) and arr[tRow][tCol] == '*':
				leftTravel += 1
				tRow -= 1
				tCol -= 1
			rightTravel = 0
			tRow = row - 1
			tCol = i + 1
			while (tRow >= 0 and tCol < m) and arr[tRow][tCol] == '*':
				rightTravel += 1
				tRow -= 1
				tCol += 1
			temp = min(leftTravel, rightTravel)
			if temp >= k:
				store[row, i] = 1
				rightTravel = 0
				tRow = row - 1
				tCol = i + 1
				while rightTravel < temp:
					store[tRow, tCol] = 1
					tRow -= 1
					tCol += 1
					rightTravel += 1
				leftTravel = 0
				tRow = row - 1
				tCol = i - 1
				while leftTravel < temp:
					store[tRow, tCol] = 1
					tRow -= 1
					tCol -= 1
					leftTravel += 1
		row -= 1
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '.':
				continue
			if (i, j) not in store:
				print('NO')
				return
	print('YES')
T = get_int()
while T:
	(n, m, k) = get_ints()
	arr = []
	tempN = n
	while tempN:
		s = get_string()
		arr.append(s)
		tempN -= 1
	solve(n, m, k, arr)
	T -= 1


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

def si():
	return input()

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

def msi():
	return map(str, input().split())

def li():
	return list(mi())
t = ii()
for _ in range(t):
	(n, m, k) = mi()
	mat = [[0 for j in range(m)] for i in range(n)]
	res = [[0 for j in range(m)] for i in range(n)]
	for i in range(n):
		s = si()
		for j in range(m):
			mat[i][j] = s[j]
	for i in range(n - 1, -1, -1):
		for j in range(m - 1, -1, -1):
			if i == 0 or j == 0 or j == m - 1:
				if mat[i][j] == '.':
					res[i][j] = mat[i][j]
			elif mat[i][j] == '*':
				if mat[i - 1][j - 1] == '*' and mat[i - 1][j + 1] == '*':
					size = 0
					(a, b, c) = (i - 1, j - 1, j + 1)
					while a >= 0 and b >= 0 and (c < m) and (mat[a][b] == '*') and (mat[a][c] == '*'):
						a -= 1
						b -= 1
						c += 1
						size += 1
					if size >= k:
						(a, b, c) = (i - 1, j - 1, j + 1)
						res[i][j] = '*'
						while a >= 0 and b >= 0 and (c < m) and (mat[a][b] == '*') and (mat[a][c] == '*'):
							res[a][b] = '*'
							res[a][c] = '*'
							a -= 1
							b -= 1
							c += 1
			else:
				res[i][j] = mat[i][j]
	if mat == res:
		print('YES')
	else:
		print('NO')


def solve():
	(n, m, k) = map(int, input().split())
	field = [input() for _ in range(n)]
	visited = [[False] * m for _ in range(n)]

	def check(x, y):
		d = 0
		while True:
			xl = x - d
			xr = x + d
			yh = y - d
			if yh < 0 or xl < 0 or xr >= m:
				break
			if field[yh][xl] == field[yh][xr] == '*':
				d += 1
			else:
				break
		if d > k:
			for i in range(d):
				xl = x - i
				xr = x + i
				yh = y - i
				visited[yh][xl] = visited[yh][xr] = True
		return visited[y][x]
	for y in range(n - 1, -1, -1):
		for x in range(m):
			if field[y][x] == '*' and (not check(x, y)):
				print('NO')
				return
	print('YES')
for _ in range(int(input())):
	solve()


import collections
import os
import sys
from io import BytesIO, IOBase
from bisect import bisect_left
from math import gcd, log, ceil
from collections import Counter
from pprint import pprint
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')

def solve():
	(lop, w, k) = list(map(int, input().split()))
	graph = []
	new_graph_with_poss_ticks = []
	for i in range(lop):
		d = input()
		d = [i for i in d]
		d1 = ['.' for i in d]
		new_graph_with_poss_ticks.append(d1)
		graph.append(d)

	def create_tick(row, col, tick_len):
		if col < tick_len:
			return
		if len(graph[0]) - col - 1 < tick_len:
			return
		all_ticked_in_input = True
		for move in range(1, tick_len + 1):
			all_ticked_in_input = all_ticked_in_input and graph[row - move][col - move] == '*'
			all_ticked_in_input = all_ticked_in_input and graph[row - move][col + move] == '*'
			if not all_ticked_in_input:
				return
		if not all_ticked_in_input:
			return
		for move in range(1, tick_len + 1):
			new_graph_with_poss_ticks[row - move][col - move] = '*'
			new_graph_with_poss_ticks[row - move][col + move] = '*'
		new_graph_with_poss_ticks[row][col] = '*'
	for i in range(len(graph) - 1, k - 1, -1):
		for j in range(len(graph[0])):
			for d_val in range(k, len(graph[0])):
				if graph[i][j] == '*':
					create_tick(i, j, d_val)
	is_poss = True
	for row in range(len(graph)):
		for col in range(len(graph[0])):
			if new_graph_with_poss_ticks[row][col] != graph[row][col]:
				return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(solve())


def readField(n):
	field = []
	for i in range(n):
		field.append(input())
	return field

def initDotTable(n, m):
	table = []
	for i in range(n):
		row = []
		for j in range(m):
			row.append('0')
		table.append(row)
	return table

def getTick(field, y, x, k):
	m = len(field[0])
	tick = [[y, x]]
	d = 1
	while y - d >= 0 and x - d >= 0 and (x + d < m) and (field[y - d][x - d] == '*') and (field[y - d][x + d] == '*'):
		tick.append([y - d, x - d])
		tick.append([y - d, x + d])
		d += 1
	if d - 1 < k:
		return []
	else:
		return tick
t = int(input())
for tc in range(t):
	(n, m, k) = map(int, input().split())
	field = readField(n)
	table = initDotTable(n, m)
	ct = 0
	for row in field:
		for cell in row:
			if cell == '*':
				ct += 1
	if ct == 0:
		print('YES')
	elif n == 1 or m < 3:
		print('NO')
	else:
		for y in range(k, n):
			for x in range(k, m - k):
				if field[y][x] == '*':
					tick = getTick(field, y, x, k)
					if len(tick) > 0:
						for pt in tick:
							table[pt[0]][pt[1]] = 'X'
		isValid = True
		for y in range(n):
			if not isValid:
				break
			for x in range(m):
				if field[y][x] == '*' and table[y][x] == '0':
					isValid = False
					break
		if isValid:
			print('YES')
		else:
			print('NO')


import math
import sys
from sys import stdout
from collections import deque

class SeqTree:
	tree = [0] * 1
	size = 0

	def init(self, n):
		self.size = 1
		while self.size < n:
			self.size = self.size * 2
		self.tree = [[math.inf, 0]] * (2 * self.size - 1)

	def set(self, i, v):
		self.setWithPos(i, v, 0, 0, self.size)

	def build(self, a):
		n = len(a)
		self.init(n)
		self.buildWithPos(a, 0, 0, self.size)

	def sum(self, l, r):
		return self.sumWithPos(l, r, 0, 0, self.size)

	def min(self, l, r):
		return self.minWithPos(l, r, 0, 0, self.size)

	def buildWithPos(self, a, x, lx, rx):
		if rx - lx == 1:
			if lx < len(a):
				self.tree[x] = [a[lx], 1]
		else:
			m = (lx + rx) // 2
			self.buildWithPos(a, 2 * x + 1, lx, m)
			self.buildWithPos(a, 2 * x + 2, m, rx)
			var1 = self.tree[2 * x + 1]
			var2 = self.tree[2 * x + 2]
			res = [math.inf, 0]
			if var1[0] == var2[0]:
				res = [var1[0], var1[1] + var2[1]]
			elif var1[0] < var2[0]:
				res = var1
			else:
				res = var2
			self.tree[x] = res

	def setWithPos(self, i, v, x, lx, rx):
		if rx - lx == 1:
			self.tree[x] = [v, 1]
			return
		m = (lx + rx) // 2
		if i < m:
			self.setWithPos(i, v, 2 * x + 1, lx, m)
		else:
			self.setWithPos(i, v, 2 * x + 2, m, rx)
		var1 = self.tree[2 * x + 1]
		var2 = self.tree[2 * x + 2]
		res = [math.inf, 0]
		if var1[0] == var2[0]:
			res[0] = var1[0]
			res[1] = var1[1] + var2[1]
		elif var1[0] < var2[0]:
			res = var1
		else:
			res = var2
		self.tree[x] = res

	def sumWithPos(self, l, r, x, lx, rx):
		if lx >= r or l >= rx:
			return 0
		if lx >= l and rx <= r:
			return self.tree[x]
		m = (lx + rx) // 2
		s1 = self.sumWithPos(l, r, 2 * x + 1, lx, m)
		s2 = self.sumWithPos(l, r, 2 * x + 2, m, rx)
		return s1 + s2

	def minWithPos(self, l, r, x, lx, rx):
		if lx >= r or l >= rx:
			return [math.inf, 0]
		if lx >= l and rx <= r:
			return self.tree[x]
		m = (lx + rx) // 2
		var1 = self.minWithPos(l, r, 2 * x + 1, lx, m)
		var2 = self.minWithPos(l, r, 2 * x + 2, m, rx)
		res = [math.inf, 0]
		if var1[0] == var2[0]:
			res[0] = var1[0]
			res[1] = var1[1] + var2[1]
		elif var1[0] < var2[0]:
			res = var1
		else:
			res = var2
		return res

class IO:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

	@staticmethod
	def implode(sep, array):
		return sep.join((str(x) for x in array))

def solve():
	(n, m, k) = IO.list_int()
	res = []
	myres = []
	ac = [0]
	mch = 0
	v = 0
	for i in range(n):
		myres.append([0] * m)
		res.append(input())

	def check(i, j):
		ctr = 0
		for x in range(22):
			if i - x < 0:
				break
			if j - x < 0 or j + x >= m:
				break
			if res[i - x][j - x] == '*' == res[i - x][j + x]:
				ctr += 1
			else:
				break
		return ctr > k

	def write(i, j):
		for x in range(n):
			if i - x < 0:
				return True
			if j - x < 0 or j + x >= m:
				return False
			if res[i - x][j - x] == '*' == res[i - x][j + x]:
				if myres[i - x][j - x] == 0:
					ac[0] += 1
				if myres[i - x][j + x] == 0:
					ac[0] += 1
				myres[i - x][j - x] = myres[i - x][j + x] = 1
			else:
				return False
	for i in range(n - 1, 0, -1):
		for j in range(m):
			if res[i][j] == '*':
				if check(i, j):
					mch += 1
					prev = ac
					write(i, j)
					if ac != prev:
						v += 1
	for i in range(n):
		for j in range(m):
			if res[i][j] == '*' and myres[i][j] != 1 or (res[i][j] == '.' and myres[i][j] != 0):
				print('NO')
				return
	print('YES')
query_count = IO.int()
while query_count:
	query_count -= 1
	solve()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0, 1, -1, 1, -1], [0, 0, 1, -1, 1, -1, -1, 1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

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

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

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 read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		(n, m, k) = mi()
		s = []
		for i in range(n):
			s.append(si())
		f = d2(n, m, 0)

		def valid(i, j):
			if i >= 0 and i < n and (j >= 0) and (j < m):
				return True
			return False

		def col(i, j):
			if s[i][j] == '.':
				return 0
			cnt = 0
			f[i][j] += 1
			(x1, y1) = (i - 1, j - 1)
			(x2, y2) = (i - 1, j + 1)
			while True:
				if valid(x1, y1) and valid(x2, y2) and (s[x1][y1] == '*') and (s[x2][y2] == '*'):
					f[x1][y1] += 1
					f[x2][y2] += 1
					x1 -= 1
					y1 -= 1
					x2 -= 1
					y2 += 1
					cnt += 1
				else:
					break
			return cnt

		def dicol(i, j):
			if s[i][j] == '.':
				return
			(x1, y1) = (i - 1, j - 1)
			(x2, y2) = (i - 1, j + 1)
			f[i][j] -= 1
			while True:
				if valid(x1, y1) and valid(x2, y2) and (s[x1][y1] == '*') and (s[x2][y2] == '*'):
					f[x1][y1] -= 1
					f[x2][y2] -= 1
					x1 -= 1
					y1 -= 1
					x2 -= 1
					y2 += 1
				else:
					break
		flag = True
		for i in range(n - 1, -1, -1):
			for j in range(m):
				cnt = col(i, j)
				if cnt < k:
					dicol(i, j)
		for i in range(n):
			for j in range(m):
				if f[i][j] == 0 and s[i][j] == '*':
					flag = 0
					break
		if flag:
			print('YES')
		else:
			print('NO')
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	(n, m, kk) = map(int, input().split())
	grid = []
	cgrid = []
	for j in range(n):
		s = list(input())
		grid.append(s)
		cgrid.append(s.copy())
	for j in range(n - 1, -1, -1):
		for k in range(m):
			if grid[j][k] == '*':
				(lt, rt) = (0, 0)
				(cj, ck) = (j, k)
				while cj >= 0 and ck >= 0 and (grid[cj][ck] == '*'):
					lt += 1
					cj -= 1
					ck -= 1
				(cj, ck) = (j, k)
				while cj >= 0 and ck < m and (grid[cj][ck] == '*'):
					rt += 1
					cj -= 1
					ck += 1
				(cj1, cj2, ck1, ck2) = (j, j, k, k)
				if min(lt, rt) > max(1, kk):
					for l in range(min(lt, rt)):
						cgrid[cj1][ck1] = '.'
						cgrid[cj2][ck2] = '.'
						cj1 -= 1
						cj2 -= 1
						ck1 -= 1
						ck2 += 1
	poss = True
	for j in range(n):
		for k in range(m):
			if cgrid[j][k] == '*':
				poss = False
				break
	if poss:
		print('Yes')
	else:
		print('No')


import os
import sys
import math
from io import BytesIO, IOBase
import io
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
from collections import Counter
import threading
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')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(10001)]
prime[0] = prime[1] = False

def SieveOfEratosthenes(n=10000):
	p = 2
	c = 0
	while p <= n:
		if prime[p] == True:
			c += 1
			for i in range(p, n + 1, p):
				prime[i] = False
		p += 1

class DSU:

	def __init__(self, R, C):
		self.par = range(R * C + 1)
		self.rnk = [0] * (R * C + 1)
		self.sz = [1] * (R * C + 1)

	def find(self, x):
		if self.par[x] != x:
			self.par[x] = self.find(self.par[x])
		return self.par[x]

	def union(self, x, y):
		(xr, yr) = (self.find(x), self.find(y))
		if xr == yr:
			return
		if self.rnk[xr] < self.rnk[yr]:
			(xr, yr) = (yr, xr)
		if self.rnk[xr] == self.rnk[yr]:
			self.rnk[xr] += 1
		self.par[yr] = xr
		self.sz[xr] += self.sz[yr]

	def size(self, x):
		return self.sz[self.find(x)]

	def top(self):
		return self.size(len(self.sz) - 1) - 1

class LazySegTree:

	def __init__(self, _op, _e, _mapping, _composition, _id, v):

		def set(p, x):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			_d[p] = x
			for i in range(1, _log + 1):
				_update(p >> i)

		def get(p):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			return _d[p]

		def prod(l, r):
			assert 0 <= l <= r <= _n
			if l == r:
				return _e
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r >> i)
			sml = _e
			smr = _e
			while l < r:
				if l & 1:
					sml = _op(sml, _d[l])
					l += 1
				if r & 1:
					r -= 1
					smr = _op(_d[r], smr)
				l >>= 1
				r >>= 1
			return _op(sml, smr)

		def apply(l, r, f):
			assert 0 <= l <= r <= _n
			if l == r:
				return
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r - 1 >> i)
			l2 = l
			r2 = r
			while l < r:
				if l & 1:
					_all_apply(l, f)
					l += 1
				if r & 1:
					r -= 1
					_all_apply(r, f)
				l >>= 1
				r >>= 1
			l = l2
			r = r2
			for i in range(1, _log + 1):
				if l >> i << i != l:
					_update(l >> i)
				if r >> i << i != r:
					_update(r - 1 >> i)

		def _update(k):
			_d[k] = _op(_d[2 * k], _d[2 * k + 1])

		def _all_apply(k, f):
			_d[k] = _mapping(f, _d[k])
			if k < _size:
				_lz[k] = _composition(f, _lz[k])

		def _push(k):
			_all_apply(2 * k, _lz[k])
			_all_apply(2 * k + 1, _lz[k])
			_lz[k] = _id
		_n = len(v)
		_log = _n.bit_length()
		_size = 1 << _log
		_d = [_e] * (2 * _size)
		_lz = [_id] * _size
		for i in range(_n):
			_d[_size + i] = v[i]
		for i in range(_size - 1, 0, -1):
			_update(i)
		self.set = set
		self.get = get
		self.prod = prod
		self.apply = apply
MIL = 1 << 20

def makeNode(total, count):
	return total * MIL + count

def getTotal(node):
	return math.floor(node / MIL)

def getCount(node):
	return node - getTotal(node) * MIL
nodeIdentity = makeNode(0.0, 0.0)

def nodeOp(node1, node2):
	return node1 + node2
	return makeNode(getTotal(node1) + getTotal(node2), getCount(node1) + getCount(node2))
identityMapping = -1

def mapping(tag, node):
	if tag == identityMapping:
		return node
	count = getCount(node)
	return makeNode(tag * count, count)

def composition(mapping1, mapping2):
	return mapping1 if mapping1 != identityMapping else mapping2

class LazySegUpdate:

	def __init__(self, N):
		self.N = N
		n = 4 * N
		self.tree = [0] * n
		self.lazy = [0] * n

	def queryHelper(self, index, s, e, l, r):
		if self.lazy[index]:
			update = self.lazy[index]
			self.lazy[index] = 0
			self.tree[index] = max(self.tree[index], update)
			if s != e:
				self.lazy[2 * index] = max(self.lazy[2 * index], update)
				self.lazy[2 * index + 1] = max(self.lazy[2 * index + 1], update)
		if s > e or s > r or e < l:
			return 0
		if s >= l and e <= r:
			return self.tree[index]
		mid = (s + e) // 2
		return max(self.queryHelper(2 * index, s, mid, l, r), self.queryHelper(2 * index + 1, mid + 1, e, l, r))

	def updateHelper(self, index, s, e, l, r, h):
		if self.lazy[index]:
			update = self.lazy[index]
			self.lazy[index] = 0
			self.tree[index] = max(self.tree[index], update)
			if s != e:
				self.lazy[2 * index] = max(self.lazy[2 * index], update)
				self.lazy[2 * index + 1] = max(self.lazy[2 * index + 1], update)
		if s > e or s > r or e < l:
			return
		if s >= l and e <= r:
			self.tree[index] = max(self.tree[index], h)
			if s != e:
				self.lazy[2 * index] = max(self.lazy[2 * index], h)
				self.lazy[2 * index + 1] = max(self.lazy[2 * index + 1], h)
			return
		mid = (s + e) // 2
		self.updateHelper(2 * index, s, mid, l, r, h)
		self.updateHelper(2 * index + 1, mid + 1, e, l, r, h)
		self.tree[index] = max(self.tree[2 * index], self.tree[2 * index + 1])

	def query(self, l, r):
		return self.queryHelper(1, 0, self.N - 1, l, r - 1)

	def update(self, l, r, h):
		self.updateHelper(1, 0, self.N - 1, l, r - 1, h)

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return math.gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = math.gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = math.gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def distinct_factors(n):
	factors = [1]
	for (p, exp) in prime_factors(n).items():
		factors += [p ** i * factor for factor in factors for i in range(1, exp + 1)]
	return factors

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

def binarySearch(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = n
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] >= key:
			res = mid
			right = mid - 1
		else:
			left = mid + 1
	return res

def binarySearch1(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = -1
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] > key:
			right = mid - 1
		else:
			res = mid
			left = mid + 1
	return res
t = 1
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	a = []
	for i in range(n):
		a += [list(input())]
	visited = [[False] * m for i in range(n)]
	for i in range(n):
		for j in range(m):
			if a[i][j] != '*':
				continue
			kmax = 0
			while 1:
				(i1, j1) = (i - kmax - 1, j - kmax - 1)
				(i2, j2) = (i - kmax - 1, j + kmax + 1)
				if 0 <= i1 < n and 0 <= i2 < n and (0 <= j1 < m) and (0 <= j2 < m) and (a[i1][j1] == a[i2][j2] == '*'):
					kmax += 1
				else:
					break
			if kmax >= k:
				visited[i][j] = True
				for p in range(1, kmax + 1):
					visited[i - p][j - p] = visited[i - p][j + p] = True
	pos = True
	for i in range(n):
		for j in range(m):
			if not visited[i][j] and a[i][j] == '*':
				pos = False
				break
		if not pos:
			break
	print('YES' if pos else 'NO')


import sys
import collections as cc
import heapq as hp
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
try:
	for tc in range(int(input())):
		(n, m, k) = I()
		ar = [list(input().strip()) for i in range(n)]
		visi = set()

		def ch(i, j):
			(ii, jj) = (i, j)
			left = 0
			right = 0
			while ii >= 0 and jj >= 0 and (ii < n) and (jj < m) and (ar[ii][jj] == '*'):
				ii -= 1
				jj -= 1
				left += 1
			(ii, jj) = (i, j)
			while ii >= 0 and jj >= 0 and (ii < n) and (jj < m) and (ar[ii][jj] == '*'):
				ii -= 1
				jj += 1
				right += 1
			te = min(left, right)
			(le, re) = (te, te)
			(ii, jj) = (i, j)
			if te - 1 >= k:
				while le:
					le -= 1
					visi.add((ii, jj))
					ii -= 1
					jj -= 1
				(ii, jj) = (i, j)
				while re:
					re -= 1
					visi.add((ii, jj))
					ii -= 1
					jj += 1
			return te - 1
		ans = 0
		x = set()
		for i in range(n - 1, -1, -1):
			for j in range(m):
				if ar[i][j] == '*':
					now = ch(i, j)
					if now < k and (i, j) in visi:
						continue
					x.add(now)
		if x:
			if min(x) >= k:
				print('YES')
			else:
				print('NO')
		else:
			print('YES')
except Exception as e:
	print(sys.exc_info(), e)


for u in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = []
	for i in range(n):
		l.append(list(input()))
	f = 0
	d = [[0 for i in range(m)] for j in range(n)]
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*':
				d[i][j] = 1
	for i in range(n - 1, -1, -1):
		for j in range(m - 1, -1, -1):
			if l[i][j] == '*':
				(a, b) = (i - 1, j - 1)
				(x, y) = (i - 1, j + 1)
				q = 0
				p = [[i, j]]
				while a >= 0 and b >= 0 and (l[a][b] == '*') and (x >= 0) and (y < m) and (l[x][y] == '*'):
					p.append([a, b])
					p.append([x, y])
					a -= 1
					b -= 1
					x -= 1
					y += 1
					q += 1
				if q >= k:
					for ll in p:
						d[ll[0]][ll[1]] = 0
	for i in range(n):
		for j in range(m):
			if d[i][j] == 1:
				f = 1
				break
	if f == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(m, n, k) = map(int, input().split())
	ma = []
	for i in range(m):
		q = input()
		l = []
		for o in q:
			l.append(o)
		ma.append(l)
	p = [['.' for i in range(n)] for j in range(m)]
	for j in range(m):
		for h in range(n):
			count = 1
			flag = 0
			if ma[j][h] == '*':
				row = j - 1
				col1 = h - 1
				col2 = h + 1
				while True:
					if col1 < 0 or row < 0 or col2 >= n:
						break
					if ma[row][col1] != '*' or ma[row][col2] != '*':
						break
					count += 2
					row -= 1
					col1 -= 1
					col2 += 1
				if count >= 2 * k + 1:
					flag = 1
				if flag == 1:
					p[j][h] = '*'
					row = j - 1
					col1 = h - 1
					col2 = h + 1
					while True:
						if col1 < 0 or row < 0 or col2 >= n:
							break
						if ma[row][col1] != '*' or ma[row][col2] != '*':
							break
						p[row][col1] = '*'
						p[row][col2] = '*'
						row -= 1
						col1 -= 1
						col2 += 1
	if p == ma:
		print('YES')
	else:
		print('NO')


import sys
readline = sys.stdin.readline
T = int(readline())
for _ in range(T):
	(N, M, K) = map(int, readline().split())
	grid = [list(readline().rstrip()) for i in range(N)]
	grid_ = [['.' for m in range(M)] for n in range(N)]
	for k in range(K, 11):
		for n in range(N):
			for m in range(M):
				if 0 <= n - k and 0 <= m - k and (m + k < M):
					bl = True
					if grid[n][m] == '.':
						bl = False
					for i in range(1, k + 1):
						if grid[n - i][m - i] == '.':
							bl = False
						if grid[n - i][m + i] == '.':
							bl = False
					if bl:
						grid_[n][m] = '*'
						for i in range(1, k + 1):
							grid_[n - i][m - i] = '*'
							grid_[n - i][m + i] = '*'
	if grid == grid_:
		ans = 'YES'
	else:
		ans = 'NO'
	print(ans)


from sys import stdin
input = stdin.readline
rn = lambda : int(input())
rns = lambda : map(int, input().split())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().strip()
YN = lambda x: print('YES') if x else print('NO')
mod = 10 ** 9 + 7
for _ in range(rn()):
	(n, m, k) = rns()
	grid = [rs() for _ in range(n)]
	seen = [[0] * m for _ in range(n)]
	ans = True
	for row in range(n - 1, -1, -1):
		for col in range(m):
			if grid[row][col] == '*':
				d = 0
				i = 1
				j = 1
				new_cells = []
				while row - i >= 0 and col - j >= 0 and (col + j < m) and (grid[row - i][col - j] == grid[row - i][col + j] == '*'):
					d += 1
					new_cells.append((row - i, col - j))
					new_cells.append((row - i, col + j))
					i += 1
					j += 1
				if d >= k:
					seen[row][col] = 1
					for (r, c) in new_cells:
						seen[r][c] = 1
				if not seen[row][col] and (d == 0 or d < k):
					ans = False
					break
	YN(ans)


def check(field, n, m):
	for i in range(n):
		for j in range(m):
			if field[i][j] == '*':
				return False
	return True
t = int(input())
for p in range(t):
	(n, m, k) = [int(n) for n in input().split()]
	field = [['.' for j in range(m)] for i in range(n)]
	for i in range(n):
		field[i] = list(input())
	last = n - 1
	start = -1
	for i in range(n - 1, -1, -1):
		for j in range(0, m):
			if field[i][j] == '.':
				continue
			len = 0
			while i - len > 0 and j - len > 0 and (j + len + 1 < m):
				if field[i - len - 1][j - len - 1] == '.' or field[i - len - 1][j + len + 1] == '.':
					break
				len += 1
			if len >= k:
				for p in range(len + 1):
					field[i - p][j - p] = '-'
					field[i - p][j + p] = '-'
	print('YES') if check(field, n, m) else print('NO')


t = int(input())
for _ in range(t):
	(n, m, d) = list(map(int, input().split()))
	mat = []
	for r in range(n):
		mat.append(list(input()))
	vis = [[0] * m for r in range(n)]
	for r in range(n):
		for c in range(m):
			if mat[r][c] == '.':
				continue
			cnt1 = 0
			(r1, c1) = (r - 1, c - 1)
			while r1 >= 0 and c1 >= 0 and (mat[r1][c1] == '*'):
				cnt1 += 1
				r1 -= 1
				c1 -= 1
			cnt2 = 0
			(r1, c1) = (r - 1, c + 1)
			while r1 >= 0 and c1 < m and (mat[r1][c1] == '*'):
				cnt2 += 1
				r1 -= 1
				c1 += 1
			if min(cnt1, cnt2) >= d:
				vis[r][c] = 1
				lim = min(cnt1, cnt2)
				(r1, c1) = (r - 1, c - 1)
				cnt = 0
				while r1 >= 0 and c1 >= 0 and (mat[r1][c1] == '*') and (cnt < lim):
					vis[r1][c1] = 1
					r1 -= 1
					c1 -= 1
					cnt += 1
				(r1, c1) = (r - 1, c + 1)
				cnt = 0
				while r1 >= 0 and c1 < m and (mat[r1][c1] == '*') and (cnt < lim):
					vis[r1][c1] = 1
					r1 -= 1
					c1 += 1
					cnt += 1
	ans = True
	for r in range(n):
		for c in range(m):
			if mat[r][c] == '*' and vis[r][c] == 0:
				ans = False
				break
	if ans:
		print('YES')
	else:
		print('NO')


def solve():
	(m, n, k) = map(int, input().split())
	dp = [0] * m
	for i in range(m):
		dp[i] = list(input())
	for i in range(1, m):
		for j in range(1, n):
			if dp[i][j] == '.':
				continue
			(o, p, y) = (i - 1, j - 1, j + 1)
			res = 0
			while o >= 0 and p >= 0 and (y < n):
				if dp[o][p] in ('*', 2) and dp[o][y] in ('*', 2):
					res += 1
				else:
					break
				o -= 1
				p -= 1
				y += 1
			if res >= k:
				dp[i][j] = 2
				q = j
				y = j
				for f in range(i - 1, i - res - 1, -1):
					q -= 1
					y += 1
					dp[f][q] = 2
					dp[f][y] = 2
	for i in range(m):
		for j in range(n):
			if dp[i][j] == '*':
				return 'NO'
	return 'YES'
for i in range(int(input())):
	print(solve())


import random
import collections
import string
import math
import copy
import os
import sys
from io import BytesIO, IOBase
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')
mo = int(1000000000.0 + 7)

def exgcd(a, b):
	if not b:
		return (1, 0)
	(y, x) = exgcd(b, a % b)
	y -= a // b * x
	return (x, y)

def getinv(a, m):
	(x, y) = exgcd(a, m)
	return -1 if x == 1 else x % m

def comb(n, b):
	res = 1
	b = min(b, n - b)
	for i in range(b):
		res = res * (n - i) * getinv(i + 1, mo) % mo
	return res % mo

def quickpower(a, n):
	res = 1
	while n:
		if n & 1:
			res = res * a % mo
		n >>= 1
		a = a * a % mo
	return res

def dis(a, b):
	return abs(a[0] - b[0]) + abs(a[1] - b[1])

def getpref(x):
	if x > 1:
		return x * (x - 1) >> 1
	else:
		return 0

def orafli(upp):
	primes = []
	marked = [False for i in range(upp + 3)]
	prvs = [i for i in range(upp + 3)]
	for i in range(2, upp):
		if not marked[i]:
			primes.append(i)
		for j in primes:
			if i * j >= upp:
				break
			marked[i * j] = True
			prvs[i * j] = j
			if i % j == 0:
				break
	return (primes, prvs)

def lower_ord(c: str) -> int:
	return ord(c) - 97

def upper_ord(c: str) -> int:
	return ord(c) - 65

def read_list():
	return [int(i) for i in input().split()]

def read_int():
	s = input().split()
	if len(s) == 1:
		return int(s[0])
	else:
		return map(int, s)

def ask(s, i, j):
	print(f'{s} {i} {j}', flush=True)

def answer(x):
	print(f'finish {x}', flush=True)
import functools
import itertools
from fractions import Fraction
import random

def lowbit(x):
	return -x & x

def pref(x):
	return x * (x + 1) >> 1

def cum(sx, mx):
	return (sx + mx) * (mx - sx + 1) >> 1

def solve():
	(n, m, k) = read_int()
	mp = []

	def inrange(x, y):
		return x in range(0, n) and y in range(0, m)
	for i in range(n):
		mp.append(list(input()))
	for i in range(n):
		if i < k:
			continue
		for j in range(m):
			if mp[i][j] != '.':
				for dep in range(1, 114514):
					if inrange(i - dep, j - dep) and inrange(i - dep, j + dep) and (mp[i - dep][j - dep] != '.') and (mp[i - dep][j + dep] != '.'):
						continue
					else:
						break
				dep -= 1
				if dep < k:
					continue
				else:
					mp[i][j] = '#'
					for dd in range(1, dep + 1):
						mp[i - dd][j + dd] = '#'
						mp[i - dd][j - dd] = '#'
	mpp = []
	for i in mp:
		mpp.append(''.join(i))
	if '*' in ''.join(mpp):
		print('NO')
	else:
		print('YES')
T = int(input())
for ti in range(T):
	solve()


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = [list(input()) for _ in range(n)][::-1]
	new = [['.'] * m for _ in range(n)]
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*':
				h = 0
				while i + h < n and j - h >= 0 and (j + h < m) and (a[i + h][j - h] == a[i + h][j + h] == '*'):
					h += 1
				if h > k:
					for f in range(h):
						new[i + f][j - f] = new[i + f][j + f] = '*'
	if new == a:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	matrix = [list(input()) for _ in range(n)]
	seen = {'*', '1'}
	for i in range(1, n):
		for j in range(m):
			if matrix[i][j] == '*' or matrix[i][j] == '1':
				u = 1
				h = 1
				for s in range(i - 1, -1, -1):
					if j - h >= 0 and j + h < m and (matrix[s][j - h] in seen and matrix[s][j + h] in seen):
						h += 1
						u += 1
					else:
						break
				if u > k:
					h = 1
					for s in range(i - 1, -1, -1):
						if j - h >= 0 and j + h < m and (matrix[s][j - h] in seen and matrix[s][j + h] in seen):
							matrix[i][j] = '1'
							matrix[s][j - h] = '1'
							matrix[s][j + h] = '1'
							h += 1
						else:
							break
	f = 0
	for i in range(n):
		for j in range(m):
			if matrix[i][j] == '*':
				f = 1
				break
	if f == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = []
	for i in range(n):
		l.append(input())
	d = {}
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*':
				(x, y) = (i, j)
				c = 1
				p = 0
				t = [(i, j)]
				while x - c >= 0 and y + c < m and (y - c >= 0):
					if l[x - c][y + c] == '*' and l[x - c][y - c] == '*':
						t.append((x - c, j + c))
						t.append((x - c, j - c))
						p += 1
						c += 1
					else:
						break
				if p >= k:
					for z in t:
						d[z] = 1
	f = 0
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*':
				if (i, j) not in d:
					f = 1
					break
	if f == 0:
		print('YES')
	else:
		print('NO')


import sys
import math
board = []
mark = []
n = 0
m = 0
k = 0

def perform(x, y):
	nm = 1
	pointer = x
	while nm <= x and y - nm >= 0 and (y + nm < m) and (board[x - nm][y - nm] == '*') and (board[x - nm][y + nm] == '*'):
		nm = nm + 1
	if nm > k:
		for i in range(nm):
			mark[x - i][y + i] = True
			mark[x - i][y - i] = True
ttime = int(input())
for ccount in range(ttime):
	(n, m, k) = map(int, input().split())
	mark = [[False for j in range(m)] for i in range(n)]
	board = []
	for i in range(n):
		board.append(input())
	for i in range(n - 1, -1, -1):
		for j in range(0, m):
			if board[i][j] == '*':
				perform(i, j)
	bad = False
	for i in range(n):
		for j in range(m):
			if mark[i][j] == False and board[i][j] == '*':
				bad = True
	if bad:
		print('NO')
	else:
		print('YES')


import sys
for _ in range(int(sys.stdin.readline())):
	(n, m, k) = [int(i) for i in sys.stdin.readline().split()]
	g = [list(sys.stdin.readline().strip()) for i in range(n)]

	def fill(a, b):
		for i in range(1, k + 1):
			if not (0 <= a - i < n and 0 <= b - i and (b + i < m) and (g[a - i][b - i] != '.') and (g[a - i][b + i] != '.')):
				return
		for i in range(k + 1):
			g[a - i][b - i] = g[a - i][b + i] = '+'
		i = k + 1
		while 1:
			if 0 <= a - i < n and 0 <= b - i and (b + i < m) and (g[a - i][b - i] != '.') and (g[a - i][b + i] != '.'):
				g[a - i][b - i] = g[a - i][b + i] = '+'
			else:
				return
			i += 1

	def check():
		for i in range(n):
			for j in range(m):
				if g[i][j] == '*':
					return False
		return True
	for i in range(n):
		for j in range(m):
			if g[i][j] != '.':
				fill(i, j)
	sys.stdout.write('YES\n' if check() else 'NO\n')


I = input
for _ in [0] * int(I()):
	(n, m, k) = map(int, I().split())
	a = [[*I()] for _ in [0] * n]
	f = 0
	while n:
		n -= 1
		for i in range(m):
			j = 0
			while j <= min(i, m - i - 1, n) and (t := a[n - j])[i - j] < '.' > t[i + j]:
				j += 1
			f |= a[n][i] == '*' and j <= k
			if j > k:
				while j:
					j -= 1
					t = a[n - j]
					t[i - j] = t[i + j] = '#'
	print('YNEOS'[f::2])


import traceback
import os
import sys
from io import BytesIO, IOBase
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 = IOWrapper(sys.stdin)
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
from collections import defaultdict as dfd, defaultdict, Counter, deque
from functools import lru_cache
from itertools import accumulate
from heapq import *
from bisect import *

def geti():
	return int(input())

def gets():
	return input()

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

def getsl():
	return input().split()

def getinps(s):
	inps = s.split()
	m = {'i': geti, 's': gets, 'il': getil, 'sl': getsl}
	if len(inps) == 1:
		return m[s]()
	return [m[k]() for k in inps]

def get2d(nrows, ncols, n=0):
	return [[n] * ncols for r in range(nrows)]

def get_acc(a):
	return list(accumulate(a))

def get_ncr(n, r, mod=10 ** 9 + 7):
	num = den = 1
	r = min(r, n - r)
	for i in range(r):
		num = num * (n - i) % mod
		den = den * (i + 1) % mod
	return num * pow(den, mod - 2, mod) % mod

def get_nc2(n):
	return n * (n - 1) // 2

def get_npr(n, r):
	if n < r:
		return 0
	return math.factorial(n) // math.factorial(r)

def put(a):
	return ' '.join(map(str, a))
ALPHABETS = 'abcdefghijklmnopqrstuvwxyz'
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
inf = float('inf')
mod = 10 ** 9 + 7

class Solution:

	def main(self):
		(N, M, K) = getil()
		grid = []
		ans = []
		for _ in range(N):
			s = gets()
			grid.append(s)
			s = [inf if c == '.' else -1 for c in s]
			ans.append(s)
		for i in range(N):
			for j in range(M):
				if grid[i][j] == '.':
					continue
				(r, c) = (i, j)
				k = 0
				nxt = [(r - 1, c - 1), (r - 1, c + 1)]
				childs = [(i, j)]
				while True:
					q = True
					for (x, y) in nxt:
						if not (0 <= x < N and 0 <= y < M and (grid[x][y] == '*')):
							q = False
							break
					if not q:
						break
					k += 1
					((x1, y1), (x2, y2)) = nxt
					childs.extend(nxt)
					nxt = [(x1 - 1, y1 - 1), (x2 - 1, y2 + 1)]
				if k:
					for (x, y) in childs:
						ans[x][y] = max(ans[x][y], k)
		for i in grid:
			pass
		return min((min(row) for row in ans)) >= K
try:
	Sol = Solution()
	Test = geti()
	for Case in range(Test):
		ans = Sol.main()
		ans = 'YES' if ans else 'NO'
		print(ans)
except Exception as e:
	print(e)
	traceback.print_exc()


import math
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	grid = []
	for i in range(n):
		grid.append(input())
	marked = set()
	visited = set()
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*':
				marked.add((i, j))
	for (r, c) in marked:
		temp = set()
		(lrow, lcol) = (r - 1, c - 1)
		(rrow, rcol) = (r - 1, c + 1)
		s = 0
		while lrow >= 0 and lcol >= 0 and (rcol < m) and ((lrow, lcol) in marked) and ((rrow, rcol) in marked):
			temp.add((lrow, lcol))
			temp.add((rrow, rcol))
			s += 1
			rrow -= 1
			lrow -= 1
			rcol += 1
			lcol -= 1
		if s >= k:
			visited = visited.union(temp)
			visited.add((r, c))
	if len(visited) == len(marked):
		print('YES')
	else:
		print('NO')


for cycle in range(int(input())):
	(n, m, k) = [int(x) for x in input().split()]
	a = []
	for i in range(n):
		a.append([x == '*' for x in input()])
	b = [[0] * m for x in range(n)]
	for x in range(m):
		for y in range(n):
			if a[y][x]:
				depth = 0
				while depth < n:
					if y - depth < 0 or x - depth < 0 or x + depth >= m:
						break
					if not (a[y - depth][x - depth] and a[y - depth][x + depth]):
						break
					depth += 1
				if depth > k:
					for i in range(0, depth):
						b[y - i][x - i] = b[y - i][x + i] = 1
	print('YNEOS'[a != b::2])


t = int(input())
for _ in range(t):
	(n, m, k) = [int(i) for i in input().strip().split()]
	f = []
	for _ in range(n):
		f.append(list(input()))
	for i in range(n - 1, -1, -1):
		for j in range(m - 1, -1, -1):
			if f[i][j] != '.':
				flag = True
				for h in range(1, k + 1):
					try:
						if not (f[i - h][j + h] != '.' and f[i - h][j - h] != '.' and (i - h >= 0) and (j - h >= 0)):
							flag = False
							break
					except IndexError:
						flag = False
						break
				if flag:
					h = 0
					while True:
						try:
							if f[i - h][j + h] != '.' and f[i - h][j - h] != '.' and (i - h >= 0) and (j - h >= 0):
								f[i - h][j + h] = '0'
								f[i - h][j - h] = '0'
							else:
								break
						except IndexError:
							break
						h += 1
	ans = 'YES'
	for i in range(n):
		for j in range(m):
			if f[i][j] == '*':
				ans = 'NO'
	print(ans)


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	f = []
	for _ in range(n):
		tmp = list(input())
		f.append(tmp)
	for i in range(n):
		for j in range(m):
			if f[i][j] == '*' or f[i][j] == '#':
				h = 1
				while i - h >= 0 and j - h >= 0 and (j + h < m) and (f[i - h][j - h] == '*' or f[i - h][j - h] == '#') and (f[i - h][j + h] == '*' or f[i - h][j + h] == '#'):
					h += 1
				h -= 1
				if h >= k:
					for H in range(h + 1):
						f[i - H][j - H] = '#'
						f[i - H][j + H] = '#'
	check = 0
	for i in range(n):
		for j in range(m):
			if f[i][j] == '*':
				check = 1
	if check == 0:
		print('YES')
	else:
		print('NO')


def prettyprint(i, j, res):
	print(i, j, res)
	for line in f:
		print(*line)

def test(i, j):
	global f
	if i < d:
		return False
	if j < d:
		return False
	if j + d >= m:
		return False
	for k in range(1, d + 1):
		if f[i - k][j - k] == '.':
			return False
		else:
			f[i - k][j - k] = 'm'
		if f[i - k][j + k] == '.':
			return False
		else:
			f[i - k][j + k] = 'm'
	k = d + 1
	while k <= i and j >= k and (j + k < m) and (f[i - k][j - k] != '.') and (f[i - k][j + k] != '.'):
		f[i - k][j - k] = 'm'
		f[i - k][j + k] = 'm'
		k += 1
	return True

def test2(i, j):
	global f
	if i < d:
		return False
	if j < d:
		return False
	if j + d >= m:
		return False
	for k in range(1, d + 1):
		if f[i - k][j - k] == '.':
			return False
		if f[i - k][j + k] == '.':
			return False
	return True
T = int(input())
for testcase in range(1, T + 1):
	(n, m, d) = list(map(int, input().split()))
	f = []
	for i in range(n):
		f.append(list(input()))
	res = True
	for i in range(n - 1, -1, -1):
		for j in range(m):
			if f[i][j] == '*':
				res = test(i, j)
			elif f[i][j] == 'm':
				mres = test2(i, j)
				if mres:
					mres = test(i, j)
			if res == False:
				break
		if res == False:
			break
	if res:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	T = [[s == '*' for s in input()] for y in range(n)]
	Q = [[b for b in l] for l in T]
	b = 1
	for i in range(n):
		for j in range(m):
			if Q[i][j]:
				d = 0
				while j - d >= 0 and j + d < m and (i - d >= 0) and T[i - d][j - d] and T[i - d][j + d]:
					d += 1
				if d - 1 >= k:
					for s in range(d):
						Q[i - s][j - s] = 0
						Q[i - s][j + s] = 0
				else:
					b = False
	if not any((any(l) for l in Q)):
		print('YES')
	else:
		print('NO')


sr = lambda : input()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
inf = 10 ** 18
mod = 998244353
test = ir()
for t in range(test):
	(n, m, k) = lr()
	a = [sr() for i in range(n)]
	visited = [[False for i in range(m)] for j in range(n)]

	def judge(i, j):
		if visited[i][j] == True:
			flg = True
			for h in range(1, k + 1):
				I = i - h
				J = j - h
				if not (0 <= I < n and 0 <= J < m and (a[I][J] == '*')):
					flg = False
					break
				I = i - h
				J = j + h
				if not (0 <= I < n and 0 <= J < m and (a[I][J] == '*')):
					flg = False
					break
			if not flg:
				return False
			max_h = min(i, j, m - j - 1)
			for h in range(1, max_h + 1):
				I_r = i - h
				J_r = j - h
				if 0 <= I_r < n and 0 <= J_r < m and (a[I_r][J_r] == '*'):
					I_l = i - h
					J_l = j + h
					if 0 <= I_l < n and 0 <= J_l < m and (a[I_l][J_l] == '*'):
						visited[I_r][J_r] = True
						visited[I_l][J_l] = True
					else:
						break
				else:
					break
			return True
		else:
			visited[i][j] = True
			for h in range(1, k + 1):
				I = i - h
				J = j - h
				if 0 <= I < n and 0 <= J < m and (a[I][J] == '*'):
					visited[I][J] = True
				else:
					return False
				I = i - h
				J = j + h
				if 0 <= I < n and 0 <= J < m and (a[I][J] == '*'):
					visited[I][J] = True
				else:
					return False
			max_h = min(i, j, m - j - 1)
			for h in range(k + 1, max_h + 1):
				I_r = i - h
				J_r = j - h
				if 0 <= I_r < n and 0 <= J_r < m and (a[I_r][J_r] == '*'):
					I_l = i - h
					J_l = j + h
					if 0 <= I_l < n and 0 <= J_l < m and (a[I_l][J_l] == '*'):
						visited[I_r][J_r] = True
						visited[I_l][J_l] = True
					else:
						break
				else:
					break
			return True
	ans = True
	for i in range(n - 1, -1, -1):
		for j in range(m - 1, -1, -1):
			if a[i][j] == '*' and visited[i][j] == False:
				flg = judge(i, j)
				if not flg:
					ans = False
					break
			elif a[i][j] == '*' and visited[i][j] == True:
				judge(i, j)
		if not ans:
			break
	if ans:
		print('Yes')
	else:
		print('No')


def test():
	t = int(input())
	for _ in range(t):
		(n, m, k) = map(int, input().split(' '))
		board = []
		for ___ in range(n):
			board.append(input())
		for i in range(n - 1, -1, -1):
			for j in range(m):
				if board[i][j] in ['*', '&']:
					is_vi = True
					for h in range(1, min(m - 1 - j, j, i) + 1):
						if min(m - 1 - j, j, i) < k:
							continue
						if board[i - h][j + h] == '.' or board[i - h][j - h] == '.':
							is_vi = False
						if is_vi:
							if board[i - h][j + h] in ['*', '&'] and board[i - h][j - h] in ['*', '&']:
								l_i = list(board[i])
								l_i[j] = '&'
								board[i] = ''.join(l_i)
								l_i__h = list(board[i - h])
								l_i__h[j + h] = '&'
								l_i__h[j - h] = '&'
								board[i - h] = ''.join(l_i__h)
		flag = True
		for i in range(n):
			for j in range(m):
				if board[i][j] == '*':
					flag = False
		if flag:
			print('YES')
		else:
			print('NO')
test()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	g = []
	visited = []
	for i in range(n):
		g.append(input())
		visited.append([0] * m)
	c = []
	for i in range(n):
		for j in range(m):
			if g[i][j] == '*':
				if i - 1 >= 0 and j + 1 < m and (j - 1 >= 0) and (g[i - 1][j + 1] == '*') and (g[i - 1][j - 1] == '*'):
					c.append([i, j])
	f = 0
	for i in range(len(c)):
		(x, y) = c[i]
		(x1, y1, x2, y2) = (x, y, x, y)
		l1 = 0
		while x1 >= 0 and y1 >= 0 and (g[x1][y1] == '*'):
			l1 += 1
			x1 -= 1
			y1 -= 1
		l2 = 0
		while x2 >= 0 and y2 < m and (g[x2][y2] == '*'):
			l2 += 1
			x2 -= 1
			y2 += 1
		d = min(l1 - 1, l2 - 1)
		if d >= k:
			(x1, y1, x2, y2) = (x, y, x, y)
			l1 = 0
			while x1 >= 0 and y1 >= 0 and (g[x1][y1] == '*'):
				visited[x1][y1] = 1
				l1 += 1
				x1 -= 1
				y1 -= 1
				if l1 == d + 1:
					break
			l2 = 0
			while x2 >= 0 and y2 < m and (g[x2][y2] == '*'):
				visited[x2][y2] = 1
				l2 += 1
				x2 -= 1
				y2 += 1
				if l2 == d + 1:
					break
	for i in range(n):
		for j in range(m):
			if g[i][j] == '*' and visited[i][j] == 0:
				f = 1
				break
		if f:
			break
	if f:
		print('NO')
	else:
		print('YES')


import sys
readline = sys.stdin.readline
T = int(readline())
for t in range(T):
	(N, M, K) = map(int, readline().split())
	S = [list(readline().rstrip()) for i in range(N)]
	for i in range(N):
		for j in range(M):
			if S[i][j] == '.':
				continue
			for d in range(K + 1):
				if i - d < 0 or j - d < 0 or M <= j + d:
					break
				if S[i - d][j - d] == '.' or S[i - d][j + d] == '.':
					break
			else:
				d = 0
				while True:
					if 0 <= i - d and 0 <= j - d and (j + d < M):
						if S[i - d][j - d] != '.' and S[i - d][j + d] != '.':
							S[i - d][j - d] = 'o'
							S[i - d][j + d] = 'o'
						else:
							break
						d += 1
					else:
						break
	ok = True
	for i in range(N):
		for j in range(M):
			if S[i][j] == '*':
				ok = False
				break
		if not ok:
			break
	if ok:
		print('YES')
	else:
		print('NO')


intput = lambda : map(int, input().split())
xdirs = ((-1, -1), (-1, 1), (1, -1), (1, 1))

def process(r, c, g):
	seen = {(r, c)}
	(i, j) = (r - 1, c - 1)
	(k, l) = (r - 1, c + 1)
	size = 0
	while g[i][j] == g[k][l] == '*':
		size += 1
		seen.add((i, j))
		seen.add((k, l))
		(i, j) = (i - 1, j - 1)
		(k, l) = (k - 1, l + 1)
	return (size, seen)

def solve():
	marks = 0
	ticks = []
	seen = set()
	(n, m, k) = intput()
	grid = ['.' * (m + 2)]
	grid += ['.' + input() + '.' for _ in range(n)]
	grid += ['.' * (m + 2)]
	for r in range(1, n + 1):
		for c in range(1, m + 1):
			if grid[r][c] != '*':
				continue
			marks += 1
			if grid[r - 1][c - 1] == '.':
				continue
			if grid[r - 1][c + 1] == '.':
				continue
			p = process(r, c, grid)
			ticks.append(p)
	if marks == 0:
		return 'YES'
	for (s, t) in reversed(sorted(ticks)):
		if s < k:
			break
		for (x, y) in t:
			seen.add((x, y))
		if len(seen) == marks:
			return 'YES'
	return 'NO'
(t,) = intput()
for i in range(t):
	print(solve())


from __future__ import print_function
from math import *
from collections import deque
import os
import sys
from io import BytesIO, IOBase

def main():
	pass
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')
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)])

def invr():
	return map(int, input().split())
for _ in range(inp()):
	(n, m, k) = invr()
	v = [[0] * m for i in range(n)]
	l = []
	for i in range(n):
		l.append(input())
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*':
				x = i
				while x >= 0:
					height = i - x
					f = 1
					left = j - height
					right = j + height
					if left >= 0 and right < m:
						if l[x][left] == l[x][right] == '*':
							x -= 1
							continue
						else:
							f = 0
							break
					else:
						f = 0
						break
				if f == 0:
					height -= 1
				if height >= k:
					for h in range(height + 1):
						v[i - h][j + h] = v[i - h][j - h] = 1
	f = 1
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*' and v[i][j] == 0:
				f = 0
	if f:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = []
	for i in range(n):
		l.append([*input()])
	l = l[::-1]
	for nuz in range(0, n - k):
		for d in range(k, m - k):
			if l[nuz][d] == '*' or l[nuz][d] == '_':
				i = 0
				if 1 == 1:
					i = 0
					while True:
						if d - i < 0 or d + i >= m or nuz + i >= n or (l[nuz + i][d + i] == '.') or (l[nuz + i][d - i] == '.'):
							break
						i += 1
					if i > k:
						ff = i
						i = 0
						while ff:
							l[nuz + i][d + i] = '_'
							l[nuz + i][d - i] = '_'
							i += 1
							ff -= 1
	g = 1
	for x in range(n):
		for i in range(m):
			if l[x][i] == '*':
				g = 0
				break
	print(['NO', 'YES'][g])


import time
import os, sys
from datetime import datetime
from math import floor, sqrt, gcd, factorial, ceil, log2
from collections import Counter, defaultdict
import bisect
from itertools import chain
from collections import deque
from sys import maxsize as INT_MAX
from itertools import permutations
from collections import deque
import heapq
(ONLINE_JUDGE, INF, mod) = (False, float('inf'), int(1000000000.0) + 7)
if os.path.exists('D:\\vimstuff'):
	ONLINE_JUDGE = True
	sys.stdin = open('D:\\vimstuff\\inp.txt', 'r')
	sys.stdout = open('D:\\vimstuff\\out.txt', 'w')

def readint():
	return int(sys.stdin.readline())

def readstr():
	return sys.stdin.readline()

def readlst():
	return list(map(int, sys.stdin.readline().strip().split()))

def readmul():
	return map(int, sys.stdin.readline().strip().split())

def mulfloat():
	return map(float, sys.stdin.readline().strip().split())

def flush():
	return sys.stdout.flush()

def power_two(x):
	return 1 << x

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

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
			return n - leftGreater

def lower_bound(arr, n, val):
	(l, r) = (-1, n)
	while r > l + 1:
		m = int(l + r >> 1)
		if arr[m] < val:
			l = m
		else:
			r = m
	return r

def upper_bound(arr, n, val):
	(l, r) = (-1, n)
	while r > l + 1:
		m = int(l + r >> 1)
		if arr[m] <= val:
			l = m
		else:
			r = m
	return l

def binpow(a, n, mod):
	res = 1
	while n:
		if n & 1:
			res = res * a % mod
			n -= 1
		a = a * a % mod
		n = n >> 1
	return res

def printmat(l, seperate=True):
	for i in range(0, len(l)):
		if seperate:
			print(*l[i], sep=' ')
		else:
			print(*l[i], sep='')

def is_perfect_square(num):
	temp = num ** 0.5
	return temp // 1 == temp

def find(res):
	n1 = res
	while par[n1] != n1:
		par[n1] = par[par[n1]]
		n1 = par[n1]
	return n1

def union(u, v):
	(p1, p2) = (find(u), find(v))
	if p1 == p2:
		return 0
	if rank[p1] > rank[p2]:
		(p1, p2) = (p2, p1)
	par[p1] = p2
	rank[p2] += rank[p1]
	return 1

class PriorityQueue:

	def __init__(self, elements=None):
		if elements == None:
			self.elements = list()
		elif type(elements) == list:
			heapq.heapify(elements)
			self.elements = elements
		self.cnt = 0

	def __str__(self):
		return str(self.elements)

	def isEmpty(self):
		return len(self.elements) == 0

	def push(self, element):
		heapq.heappush(self.elements, element)
		self.cnt += 1

	def pop(self):
		self.cnt -= 1
		return heapq.heappop(self.elements)

	def getlen(self):
		return self.cnt

def checkstar(s):
	for i in range(len(s)):
		for j in range(len(s[0])):
			if s[i][j] == '*':
				return True
	return False

def john_3_16():
	(n, m, k) = readmul()
	s = []
	for _ in range(n):
		s.append([i for i in input()])
	vis = [[False for _ in range(m)] for _ in range(n)]
	if checkstar(s) == False:
		print('YES')
		return
	if k >= n:
		print('NO')
		return
	ro = k
	while ro < n:
		for j in range(m):
			if s[ro][j] == '*':
				(w, dis) = (1, 0)
				for h in range(ro - 1, -1, -1):
					if j + w < m and j - w >= 0 and (s[h][w + j] == '*') and (s[h][w + j] == s[h][j - w]):
						dis += 1
					else:
						break
					w += 1
				if dis >= k:
					vis[ro][j] = True
					w = 1
					for h in range(ro - 1, -1, -1):
						if j + w < m and j - w >= 0 and (s[h][w + j] == s[h][j - w]) and (s[h][w + j] == '*'):
							(vis[h][w + j], vis[h][j - w]) = (True, True)
						else:
							break
						w += 1
		ro += 1
	for i in range(n):
		for j in range(m):
			if s[i][j] == '*' and vis[i][j] == False:
				print('NO')
				return
	print('YES')
	return

def main():
	tc = readint()
	start = time.time()
	while tc:
		john_3_16()
		tc -= 1
	if ONLINE_JUDGE:
		print(f'{(time.time() - start) * 1000}ms')
		pass
main()


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = [input() for _ in range(n)]

	def check(x, y):
		return x >= 0 and y >= 0 and (y < m) and (a[x][y] == '*')
	points = set()
	for i in range(n):
		for j in range(m):
			if a[i][j] == '.':
				continue
			(x, y) = (i, j)
			(st1, st2) = ([], [])
			while check(x, y):
				st1.append((x, y))
				x -= 1
				y -= 1
			(x, y) = (i, j)
			while check(x, y):
				st2.append((x, y))
				x -= 1
				y += 1
			mn = min(len(st1), len(st2))
			if len(st1) - 1 >= k and len(st2) - 1 >= k:
				for K in range(mn):
					points.add(st1[K])
					points.add(st2[K])
	ans = 'YES'
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*' and (i, j) not in points:
				ans = 'NO'
				break
	print(ans)


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	k += 1
	a = []
	b = []
	for i in range(n):
		s = input()
		for j in range(m):
			if s[j] == '*':
				a.append((j, i))
	for y in range(n, -1, -1):
		for x in range(m, -1, -1):
			bb = []
			i = 0
			while True:
				if (x + i, y - i) in a:
					bb.append((x + i, y - i))
				else:
					break
				if (x - i, y - i) in a:
					bb.append((x - i, y - i))
				else:
					break
				if i >= k - 1:
					b += bb
				i += 1
	if set(a) == set(b):
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
from itertools import accumulate as ac
from random import randint as ri
mod = int(1000000000.0) + 7
mod = 998244353
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	(n, m, k) = inp()
	arr = []
	for i in range(n):
		arr.append(ips())
	dic = {}
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				tup = (i, j)
				dic[tup] = False
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				d = 0
				x = i
				y = j
				pt = 0
				pos = [[x, y]]
				while x >= 0:
					x -= 1
					pt += 1
					if 0 <= y - pt <= y + pt <= m - 1:
						if arr[x][y - pt] == arr[x][y + pt] == '*':
							d += 1
							pos.append([x, y - pt])
							pos.append([x, y + pt])
						else:
							break
					else:
						break
				if d >= k:
					for ii in pos:
						tup = tuple(ii)
						dic[tup] = True
	flag = True
	for i in dic:
		flag = dic[i] and flag
	if flag:
		ans = 'YES'
	else:
		ans = 'NO'
	print(ans)


import sys
from collections import deque
input = sys.stdin.readline
T = int(input())
while T:
	T -= 1
	(n, m, k) = map(int, input().split())
	field = [list(input()) for _ in range(n)]
	ch = [[0 for _ in range(m)] for _ in range(n)]
	queue = deque()
	for i in range(n):
		for j in range(m):
			if field[i][j] == '*':
				queue.append([i, j])
	while queue:
		(x, y) = queue.popleft()
		h = 0
		while True:
			if 0 <= x - h and 0 <= y - h and (y + h < m) and (field[x - h][y - h] == '*') and (field[x - h][y + h] == '*'):
				h += 1
			else:
				h -= 1
				break
		if h >= k:
			for i in range(h + 1):
				ch[x - i][y - i] = 1
				ch[x - i][y + i] = 1
	flag = 0
	for i in range(n):
		for j in range(m):
			if field[i][j] == '*' and (not ch[i][j]):
				print('NO')
				flag = 1
				break
		if flag:
			break
	if not flag:
		print('YES')


def solve(grid, R, C, K):
	status = [row[:] for row in grid]
	rem = sum((v for row in grid for v in row))
	for r in range(1, R):
		for c in range(1, C):
			if status[r][c] == 0:
				continue
			mxk = 0
			for k in range(1, R):
				if r - k < 0 or c - k < 0 or c + k >= C:
					break
				if grid[r - k][c - k] == 0 or grid[r - k][c + k] == 0:
					break
				if k >= K:
					mxk = k
			if mxk > 0:
				status[r][c] = 0
				rem -= 1
				for k in range(1, mxk + 1):
					rem -= status[r - k][c - k] + status[r - k][c + k]
					status[r - k][c - k] = 0
					status[r - k][c + k] = 0
	return rem == 0

def main():
	from sys import stdin
	T = int(stdin.readline().strip())
	for _ in range(T):
		(R, C, K) = map(int, stdin.readline().strip().split())
		grid = []
		for _ in range(R):
			row = stdin.readline().strip()
			row = [1 if v == '*' else 0 for v in row]
			grid.append(row)
		out = solve(grid, R, C, K)
		print('YES' if out else 'NO')
main()


output = []
for _t in range(int(input())):
	(n, m, k) = map(int, input().split())
	field = [list(input()) for _ in range(n)]
	possible = [['.'] * m for _ in range(n)]
	for i in range(n):
		for j in range(m):
			if field[i][j] == '*':
				wi = i - 1
				sj = j - 1
				bj = j + 1
				while wi >= 0 and sj >= 0 and (field[wi][sj] == '*') and (bj < m) and (field[wi][bj] == '*'):
					wi -= 1
					sj -= 1
					bj += 1
				if i - wi > k:
					possible[i][j] = '*'
					size = i - wi - 1
					wi = i - 1
					sj = j - 1
					bj = j + 1
					for _ in range(size):
						possible[wi][sj] = '*'
						possible[wi][bj] = '*'
						wi -= 1
						sj -= 1
						bj += 1
	print('Yes' if field == possible else 'No')


def do(mat, i, j, k, n, m):
	o = 1
	ret = [[i, j]]
	while i - o >= 0 and j + o < m and (j - o >= 0) and (mat[i - o][j + o] == '*') and (mat[i - o][j - o] == '*'):
		ret.append([i - o, j + o])
		ret.append([i - o, j - o])
		o += 1
	if len(ret) >= 2 * k + 1:
		return ret
	return []
T = int(input())
for t in range(T):
	(n, m, k) = map(int, input().split())
	mat = [list(input()) for i in range(n)]
	stars = []
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '*':
				a = do(mat, i, j, k, n, m)
				if a:
					stars.extend(a)
	for ip in stars:
		if ip:
			mat[ip[0]][ip[1]] = '.'
	for i in range(n):
		if '*' in mat[i]:
			print('NO')
			break
	else:
		print('YES')


def isValidTick(mat, i, j):
	steps = 0
	j1 = j2 = j
	while i >= 0 and j1 >= 0 and (j2 < len(mat[0])):
		if mat[i][j1] == '.' or mat[i][j2] == '.':
			break
		steps += 1
		i -= 1
		j1 -= 1
		j2 += 1
	return steps - 1

def clean_stars(mat, i, j, d):
	j1 = j2 = j
	while i >= 0 and j1 >= 0 and (j2 < len(mat[0])) and d:
		mat[i][j1] = '.'
		mat[i][j2] = '.'
		i -= 1
		j1 -= 1
		j2 += 1
		d -= 1
for _ in range(int(input())):
	(r, c, k) = list(map(int, input().split()))
	mat = []
	for i in range(r):
		mat.append(list(input()))
	clean_positions = []
	for i in range(k, r):
		for j in range(k, c - k):
			d = isValidTick(mat, i, j)
			if d >= k:
				clean_positions.append((i, j, d + 1))
	for (i, j, d) in clean_positions:
		clean_stars(mat, i, j, d)
	valid = True
	for row in mat:
		if '*' in row:
			valid = False
			break
	if valid:
		print('YES')
	else:
		print('NO')


from sys import *
input = stdin.readline
import threading
from bisect import *
import math
from collections import *
import operator
from heapq import *
from itertools import *
inf = 10 ** 19
mod = 10 ** 9 + 9
MOD = 998244353
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
drow = [0, 1, 0, -1]
dcol = [-1, 0, 1, 0]
setrecursionlimit(200005)

def asc(c):
	return ord(c) - 97 + 1

def check(x, y):
	i = x
	j = y
	cnt1 = 0
	while i - 1 >= 0 and j - 1 >= 0 and (mat[i - 1][j - 1] == '*'):
		cnt1 += 1
		i -= 1
		j -= 1
	cnt2 = 0
	while x - 1 >= 0 and y + 1 < m and (mat[x - 1][y + 1] == '*'):
		cnt2 += 1
		x -= 1
		y += 1
	return min(cnt1, cnt2)

def solve(val, x, y):
	ans[x][y] = '*'
	i = x - 1
	j = y - 1
	for _ in range(val):
		ans[i][j] = '*'
		i -= 1
		j -= 1
	x -= 1
	y += 1
	for _ in range(val):
		ans[x][y] = '*'
		x -= 1
		y += 1

def wow():
	for i in range(n):
		if mat[i] != ans[i]:
			return False
	return True
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	mat = []
	for _ in range(n):
		row = list(input())[:-1]
		mat.append(row)
	ans = [['.' for _ in range(m)] for _ in range(n)]
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '*':
				get = check(i, j)
				if get >= k:
					solve(get, i, j)
	if wow():
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, m, k) = list(map(int, input().split()))
	a = [[j for j in input()] for i in range(n)]
	b = [[0 for j in range(m)] for i in range(n)]
	for d in range(k, n):
		for i in range(d, n):
			for j in range(d, m - d):
				if a[i][j] != '*':
					continue
				for l in range(1, d + 1):
					if a[i - l][j - l] != '*' or a[i - l][j + l] != '*':
						break
				else:
					b[i][j] = 1
					for l in range(1, d + 1):
						b[i - l][j - l] = 1
						b[i - l][j + l] = 1
	z = 1
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*' and b[i][j] == 0:
				print('NO')
				z = 0
				break
		if z == 0:
			break
	if z:
		print('YES')


import sys

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

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

def cin_int():
	return int(input())
from collections import Counter

def sv(data, k):
	left = Counter()
	right = Counter()
	top = {}
	all_start = set()
	for i in range(len(data)):
		for j in range(len(data[0])):
			if data[i][j] == '*':
				all_start.add((i, j))
				left[i, j] = left[i - 1, j - 1] + 1
				right[i, j] = right[i - 1, j + 1] + 1
				(l, r) = (left[i, j], right[i, j])
				if l - 1 >= k and r - 1 >= k:
					top[i, j] = min(l, r)
	for (p, d) in top.items():
		(x, y) = p
		rm = set()
		for i in range(d):
			rm.add((x - i, y - i))
			rm.add((x - i, y + i))
		all_start -= rm
	if all_start:
		return 'NO'
	else:
		return 'YES'
for _ in range(cin_int()):
	(n, m, k) = cin_int_ls()
	data = []
	for _ in range(n):
		data.append(input())
	print(sv(data, k))


def xs(x, y, n, m):
	outp = []
	yy = y
	for i in range(n * m):
		x -= 1
		y -= 1
		yy += 1
		if x < 0 or y < 0 or yy >= m:
			break
		outp.append([x, y])
		outp.append([x, yy])
	return outp
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	aa = []
	for i in range(n):
		b = str(input())
		aa.append(b)
	a = []
	kt = []
	for i in range(n):
		b = []
		for j in range(m):
			if aa[i][j] == '.':
				b.append(0)
			else:
				kt.append([i, j])
				b.append(1)
		a.append(b)
	for i in range(n - 1, -1, -1):
		for j in range(m - 1, -1, -1):
			if a[i][j] == 1 or a[i][j] == 2:
				g = xs(i, j, n, m)
				sp = 0
				for gg in range(len(g) // 2):
					if (a[g[gg * 2][0]][g[gg * 2][1]] == 1 or a[g[gg * 2][0]][g[gg * 2][1]] == 2) and (a[g[gg * 2 + 1][0]][g[gg * 2 + 1][1]] == 1 or a[g[gg * 2 + 1][0]][g[gg * 2 + 1][1]] == 2):
						if gg + 1 == k:
							a[i][j] = 2
							for ge in range(gg + 1):
								a[g[ge * 2][0]][g[ge * 2][1]] = 2
								a[g[ge * 2 + 1][0]][g[ge * 2 + 1][1]] = 2
							sp = 1
						elif sp == 1:
							a[g[gg * 2][0]][g[gg * 2][1]] = 2
							a[g[gg * 2 + 1][0]][g[gg * 2 + 1][1]] = 2
					else:
						break
	sv = 0
	for i in range(n):
		for j in range(m):
			if a[i][j] == 1:
				sv = 1
				break
		if sv == 1:
			break
	if sv == 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def read(c):
	if c == '*':
		return 1
	if c == '.':
		return 0

def check(a, i, j, m):
	if a[i][j] == 0:
		return -1
	d = 0
	while True:
		h = d + 1
		if i - h < 0 or j - h < 0 or j + h >= m or (a[i - h][j - h] == 0) or (a[i - h][j + h] == 0):
			return d
		else:
			d = h

def checkoff(a, i, j, d):
	for h in range(d + 1):
		a[i - h][j - h] = 2
		a[i - h][j + h] = 2
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = []
	for _ in range(n):
		a.append(list(map(read, input())))
	for i in range(n):
		for j in range(m):
			d = check(a, i, j, m)
			if d >= k:
				checkoff(a, i, j, d)
	ok = True
	for i in range(n):
		for j in range(m):
			if a[i][j] == 1:
				ok = False
	print('YES' if ok else 'NO')


def get_size(possible_solution, matrix, i, j, m):
	offset = 1
	while i - offset >= 0 and j - offset >= 0 and (j + offset < m) and (matrix[i - offset][j - offset] == '*') and (matrix[i - offset][j + offset] == '*'):
		offset += 1
	return offset - 1

def draw(possible_solution, matrix, i, j, m):
	offset = 1
	while i - offset >= 0 and j - offset >= 0 and (j + offset < m) and (matrix[i - offset][j - offset] == '*') and (matrix[i - offset][j + offset] == '*'):
		possible_solution[i - offset][j - offset] = True
		possible_solution[i - offset][j + offset] = True
		offset += 1

def solve():
	(n, m, k) = [int(s) for s in input().split(' ')]
	matrix = []
	for row in range(n):
		matrix.append(list(input()))
	possible_solution = [[False for j in range(m)] for i in range(n)]
	for i in range(1, n):
		for j in range(1, m - 1):
			if matrix[i][j] == '*':
				if matrix[i - 1][j - 1] == '*' and matrix[i - 1][j + 1] == '*':
					if get_size(possible_solution, matrix, i, j, m) >= k:
						possible_solution[i][j] = True
						draw(possible_solution, matrix, i, j, m)
	for i in range(n):
		for j in range(m):
			if matrix[i][j] == '*' and possible_solution[i][j] == False:
				print('NO')
				return
	print('YES')
	return
t = int(input())
for i in range(1, t + 1):
	solve()


import os, sys
from io import BytesIO, IOBase

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, 8192))
			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, 8192))
			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')
inp = lambda dtype: [dtype(x) for x in input().split()]
inp_2d = lambda dtype, n: [dtype(input()) for _ in range(n)]
inp_2ds = lambda dtype, n: [inp(dtype) for _ in range(n)]
inp_enu = lambda dtype: [(i, x) for (i, x) in enumerate(inp(dtype))]
inp_enus = lambda dtype, n: [[i] + inp(dtype) for i in range(n)]
ceil1 = lambda a, b: (a + b - 1) // b
valid = lambda x, y: -1 < x < n and -1 < y < m and (grid[x][y] == '*')
for _ in range(int(input())):
	(n, m, k) = inp(int)
	(grid, mem, ans) = (inp_2d(str, n), [[False] * m for i in range(n)], 'yes')
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*':
				(x, y, d, tem, tem2) = (i, j, 0, [], [])
				while valid(x, y):
					(xl, yl) = (i, j + 2 * d)
					tem2.append((x, y))
					while valid(xl, yl) and [xl, yl] != [x, y]:
						tem.append((xl, yl))
						xl += 1
						yl -= 1
					if len(tem) == d and d >= k:
						for (x, y) in tem:
							mem[x][y] = True
						for (x, y) in tem2:
							mem[x][y] = True
					tem = []
					x += 1
					y += 1
					d += 1
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*' and (not mem[i][j]):
				ans = 'no'
	print(ans)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

def inps():
	return sys.stdin.readline()

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()
for _ in range(inp()):
	(n, m, k) = inpl()
	s = [input() for _ in range(n)]
	seen = [[0] * m for _ in range(n)]
	for i in range(n):
		for j in range(m):
			if s[i][j] == '.':
				continue
			for h in range(100):
				(n0i, n0j) = (i - h, j - h)
				(n1i, n1j) = (i - h, j + h)
				if 0 <= n0i < n and 0 <= n1i < n and (0 <= n0j < m) and (0 <= n1j < m) and (s[n0i][n0j] == s[n1i][n1j] == '*'):
					continue
				else:
					break
			if h - 1 < k:
				continue
			for d in range(h):
				(n0i, n0j) = (i - d, j - d)
				(n1i, n1j) = (i - d, j + d)
				seen[n0i][n0j] = 1
				seen[n1i][n1j] = 1
	res = 1
	for i in range(n):
		for j in range(m):
			if s[i][j] == '*' and (not seen[i][j]):
				res = 0
	print('YES' if res else 'NO')


import os, sys
from io import BytesIO, IOBase
from collections import deque, Counter, defaultdict as dft
from heapq import heappop, heappush, heapify
from math import log, sqrt, factorial, cos, tan, sin, radians, log2, ceil, floor, gcd
from bisect import bisect, bisect_left, bisect_right
from decimal import *
import sys, threading
from itertools import permutations, combinations
from copy import deepcopy
input = sys.stdin.readline

def modI(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x += m0
	return x
ii = lambda : int(input())
si = lambda : input().rstrip()
mp = lambda : map(int, input().split())
ms = lambda : map(str, input().strip().split(' '))
ml = lambda : list(mp())
mf = lambda : map(float, input().split())
alphs = 'abcdefghijklmnopqrstuvwxyz'

def solve():
	(n, m, k) = mp()
	grid = [list(input()) for i in range(n)]
	dummy = [['.' for i in range(m)] for j in range(n)]
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*':
				d = 0
				for h in range(1, i + 1):
					if j - h >= 0 and j + h < m and (grid[i - h][j - h] == '*') and (grid[i - h][j + h] == '*'):
						d = h
					else:
						break
				if d >= k:
					dummy[i][j] = '*'
					for h in range(1, d + 1):
						dummy[i - h][j - h] = '*'
						dummy[i - h][j + h] = '*'
	print(['NO', 'YES'][grid == dummy])
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=0, func=gcd):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		start += self._size
		stop += self._size
		res_left = res_right = self._default
		while start < stop:
			if start & 1:
				res_left = self._func(res_left, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res_right = self._func(self.data[stop], res_right)
			start >>= 1
			stop >>= 1
		return self._func(res_left, res_right)

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
tc = 1
tc = ii()
for i in range(tc):
	solve()


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = []
	ans = []
	for _ in range(n):
		a.append(input())
	for i in range(n):
		for j in range(m):
			if a[i][j] == '*':
				if i >= k and j >= k:
					h = 0
					while i - h - 1 >= 0 and j - h - 1 >= 0 and (j + h + 1 <= m - 1) and (a[i - h - 1][j - h - 1] == '*') and (a[i - h - 1][j + h + 1] == '*'):
						h += 1
					if h >= k:
						temp = h
						while temp > 0:
							if (i - temp) * 100 + (j - temp) in ans:
								ans.remove((i - temp) * 100 + (j - temp))
							if (i - temp) * 100 + (j + temp) in ans:
								ans.remove((i - temp) * 100 + (j + temp))
							temp -= 1
					else:
						ans.append(i * 100 + j)
				else:
					ans.append(i * 100 + j)
	if len(ans) == 0:
		print('YES')
	else:
		print('NO')


def add(visited, i, j, d, grid):
	(n, m) = (len(grid), len(grid[0]))
	left = 0
	right = 0
	(ci, cj) = (i, j)
	while i >= 0 and j >= 0 and (grid[i][j] == '*'):
		left += 1
		i -= 1
		j -= 1
	(i, j) = (ci, cj)
	while i >= 0 and j < m and (grid[i][j] == '*'):
		right += 1
		i -= 1
		j += 1
	if min(left, right) > d:
		k = min(left, right)
		(i, j, ck) = (ci, cj, k)
		while i >= 0 and j >= 0 and (k > 0):
			visited.add((i, j))
			i -= 1
			j -= 1
			k -= 1
		k = ck
		(i, j) = (ci, cj)
		while i >= 0 and j < m and (k > 0):
			visited.add((i, j))
			i -= 1
			j += 1
			k -= 1

def valley(grid, i, j):
	(n, m) = (len(grid), len(grid[0]))
	if i - 1 >= 0 and j + 1 < m and (j - 1 >= 0) and (grid[i - 1][j + 1] == '*') and (grid[i - 1][j - 1] == '*'):
		return True
	return False

def solve(grid, n, m, k, ans):
	valley_points = []
	total = 0
	visited = set()
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*' and valley(grid, i, j):
				valley_points.append((i, j))
			if grid[i][j] == '*':
				total += 1
	for p in valley_points:
		add(visited, p[0], p[1], k, grid)
	if len(visited) != total:
		ans.append('NO')
		return
	ans.append('YES')

def main():
	t = int(input())
	ans = []
	for i in range(t):
		(n, m, k) = map(int, input().split())
		grid = []
		for j in range(n):
			grid.append(input())
		solve(grid, n, m, k, ans)
	print('\n'.join(ans))
main()


import sys, heapq
tc = int(sys.stdin.readline())
for _ in range(tc):
	(n, m, k) = map(int, sys.stdin.readline().split())
	arr = [list(sys.stdin.readline().rstrip()) for _ in range(n)]
	check = [[False] * m for _ in range(n)]
	for i in range(n - 1, -1, -1):
		for j in range(m - 1, -1, -1):
			if arr[i][j] == '*':
				left = 0
				right = 0
				(nx, ny) = (i, j)
				while 0 <= nx - 1 < n and 0 <= ny - 1 < m and (arr[nx - 1][ny - 1] == '*'):
					left += 1
					nx -= 1
					ny -= 1
				(nx, ny) = (i, j)
				while 0 <= nx - 1 < n and 0 <= ny + 1 < m and (arr[nx - 1][ny + 1] == '*'):
					right += 1
					nx -= 1
					ny += 1
				if min(left, right) >= k:
					(x, y) = (i, j)
					for p in range(min(left, right) + 1):
						check[x - p][y - p] = True
						check[x - p][y + p] = True
	can = True
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*' and (not check[i][j]):
				can = False
	print('YES' if can else 'NO')


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict, deque
from io import BytesIO, IOBase
from itertools import permutations
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.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 = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.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:
			self.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')

def get_int():
	return int(input())

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

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().strip()

def get_strs():
	return get_str().split(' ')

def flat_list(arr):
	return [item for subarr in arr for item in subarr]

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

def solve_c():
	(n, m, k) = get_ints()
	h = []
	s = set()
	SL = SortedList([])
	chk = set()
	rem = set()
	for i in range(n):
		s = get_str()
		for j in range(m):
			if s[j] == '*':
				chk.add((i, j))
				rem.add((i, j))
	for (i, j) in rem:
		s = 0
		while (i - s, j + s) in rem and (i - s, j - s) in rem:
			s += 1
		s -= 1
		if s >= k:
			for d in range(s + 1):
				chk.discard((i - d, j + d))
				chk.discard((i - d, j - d))
	if len(chk) == 0:
		return 'YES'
	else:
		return 'NO'
t = get_int()
for _ in range(t):
	print(solve_c())


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	grid = []
	for _ in range(n):
		grid.append(input().rstrip())
	vis = [[False for _ in range(m)] for _ in range(n)]
	for i in range(n - 1, 0, -1):
		for j in range(1, m - 1):
			if grid[i][j] == '*':
				d = 1
				while True:
					if i - d < 0 or j - d < 0 or j + d >= m:
						break
					if grid[i - d][j - d] == '.' or grid[i - d][j + d] == '.':
						break
					d += 1
				d -= 1
				if d >= k:
					vis[i][j] = True
					for h in range(1, d + 1):
						vis[i - h][j - h] = True
						vis[i - h][j + h] = True
	flag = True
	for a in range(n):
		for b in range(m):
			if grid[a][b] == '*' and (not vis[a][b]):
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')


inf = float('inf')
import sys
import pprint
import logging
from logging import getLogger
import array

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

def maps():
	return [int(i) for i in input().split()]
logging.basicConfig(format='%(message)s', level=logging.WARNING)
logger = getLogger(__name__)
logger.setLevel(logging.INFO)

def debug(msg, *args):
	logger.info(f'{msg}={pprint.pformat(args)}')
for __ in range(*maps()):
	(n, m, k) = maps()
	arr = [[i for i in input()] for _ in range(n)]
	check = [[False for __ in range(m)] for ___ in range(n)]

	def func(size):
		ok = False
		for i in range(n):
			for j in range(m):
				if arr[i][j] == '*':
					ii = i - 1
					j1 = j - 1
					j2 = j + 1
					s = 0
					painted = True
					while ii < n and j1 >= 0 and (j1 < m) and (j2 >= 0) and (j2 < m) and (s < size) and (ii >= 0):
						if arr[ii][j1] == arr[ii][j2] == '*':
							if check[ii][j1] == False or check[ii][j2] == False:
								painted = False
							ii -= 1
							j1 -= 1
							j2 += 1
							s += 1
						else:
							break
					if check[i][j] == False:
						painted = False
					if s == size and (not painted):
						check[i][j] = True
						ii = i - 1
						j1 = j - 1
						j2 = j + 1
						s = 0
						ok = True
						while ii < n and j1 >= 0 and (j1 < m) and (j2 >= 0) and (j2 < m) and (s < size):
							if arr[ii][j1] == arr[ii][j2] == '*':
								check[ii][j1] = check[ii][j2] = True
								ii -= 1
								j1 -= 1
								j2 += 1
								s += 1
							else:
								break
		return ok
	ans = 'YES'
	for sz in range(n + 1, 0, -1):
		x = func(sz)
		if x and sz < k:
			ans = 'NO'
	if func(0):
		ans = 'NO'
	print(ans)


def solve():
	(n, m, k) = map(int, input().split())
	a = [list(input()) for _ in range(n)]
	for i in reversed(range(n)):
		for j in reversed(range(m)):
			d = 0
			while d <= min(i, j, m - 1 - j) and a[i - d][j - d] != '.' and (a[i - d][j + d] != '.'):
				d += 1
			if d > k:
				for d in range(d):
					a[i - d][j - d] = a[i - d][j + d] = '#'
			if a[i][j] == '*':
				return False
	return True
for _ in range(int(input())):
	print('YES' if solve() else 'NO')


import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 5)
INF = 10 ** 18

def solve():
	(N, M, K) = map(int, input().split())
	field = [list(input()) for _ in range(N)]
	check = set()
	for y in range(N):
		for x in range(M):
			if field[y][x] == '*':
				check.add((y, x))
	ans = set()
	for y in range(N - 1, K - 1, -1):
		for x in range(M):
			if field[y][x] == '*':
				h = 0
				while 0 <= y - h and 0 <= x - h and (x + h < M):
					if field[y - h][x - h] == '*' and field[y - h][x + h] == '*':
						h += 1
					else:
						break
				if h > K:
					for i in range(h):
						(ly, lx) = (y - i, x - i)
						(ry, rx) = (y - i, x + i)
						ans.add((ly, lx))
						ans.add((ry, rx))
	for c in check:
		if c not in ans:
			print('NO')
			break
	else:
		print('YES')
Q = int(input())
for _ in range(Q):
	solve()


def main(t):
	(m, n, k) = map(int, input().split())
	grid = []
	for i in range(m):
		grid.append(input())
	visited = [[False for j in range(n)] for i in range(m)]
	left = [[0 for j in range(n)] for i in range(m)]
	right = [[0 for j in range(n)] for i in range(m)]
	for i in range(m):
		for j in range(n):
			if grid[i][j] == '*':
				if i > 0 and j > 0 and (grid[i - 1][j - 1] == '*'):
					left[i][j] = left[i - 1][j - 1] + 1
				if i > 0 and j + 1 < n and (grid[i - 1][j + 1] == '*'):
					right[i][j] = right[i - 1][j + 1] + 1
	for i in range(m):
		for j in range(n):
			num = min(left[i][j], right[i][j])
			if num >= k:
				li = i
				lj = j
				ri = i
				rj = j
				visited[i][j] = True
				while num > 0:
					li -= 1
					lj -= 1
					ri -= 1
					rj += 1
					visited[li][lj] = True
					visited[ri][rj] = True
					num -= 1
	ans = 'YES'
	for i in range(m):
		for j in range(n):
			if grid[i][j] == '*' and (not visited[i][j]):
				ans = 'NO'
	print(ans)
T = int(input())
t = 1
while t <= T:
	main(t)
	t += 1


for _ in range(int(input())):
	(r, c, k) = map(int, input().split())
	mat = []
	start = set()
	for i in range(r):
		temp = []
		for (j, ch) in enumerate(input()):
			if ch == '*':
				temp.append(1)
				start.add((i, j))
			else:
				temp.append(0)
		mat.append(temp)
	seen = []
	for i in range(r):
		for j in range(c):
			if (i, j) in start:
				temp = []
				(a, b) = (i, j)
				(o, d) = (i, j)
				p = -1
				while a >= 0 and b >= 0 and (o >= 0) and (d < c) and mat[a][b] and mat[o][d]:
					p += 1
					temp.append((a, b))
					temp.append((o, d))
					a -= 1
					o -= 1
					b -= 1
					d += 1
				if p >= k:
					seen += temp
	if len(set(seen)) == len(start):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
n_test = int(input())
board = []
(row, col, min_size) = (0, 0, 0)

def is_possible(r, c):
	global row, col, min_size, board
	if board[r][c] == '*' or board[r][c] == 'z':
		cl = 0
		while r - cl >= 0 and c - cl >= 0:
			if board[r - cl][c - cl] == '*' or board[r - cl][c - cl] == 'z':
				cl += 1
			else:
				break
		cr = 0
		while r - cr >= 0 and c + cr < col:
			if board[r - cr][c + cr] == '*' or board[r - cr][c + cr] == 'z':
				cr += 1
			else:
				break
		siz = min(cr, cl)
		if siz <= min_size and board[r][c] == '*':
			return False
		if siz > min_size:
			for i in range(siz):
				board[r - i][c - i] = 'z'
				board[r - i][c + i] = 'z'
	return True
for i in range(n_test):
	(row, col, min_size) = map(int, input().split())
	board = []
	for _ in range(row):
		temp = input()
		temp_list = []
		for i in range(len(temp)):
			temp_list.append(temp[i])
		board.append(temp_list)
	flag = False
	for _r in range(1, row + 1):
		for _c in range(1, col + 1):
			if board[row - _r][col - _c] == '*' or board[row - _r][col - _c] == 'z':
				if not is_possible(row - _r, col - _c):
					flag = True
					break
		if flag:
			break
	if flag:
		print('NO')
	else:
		print('YES')


from math import gcd
for i in range(int(input())):
	(n, m, t) = map(int, input().split())
	vis = [[0] * m for i in range(n)]
	ans = 'YES'
	l = []
	for i in range(n):
		l.append(input())
	for i in range(n - 1, 0, -1):
		for j in range(m):
			if l[i][j] == '*':
				d = 1
				for k in range(i - 1, -1, -1):
					if j - d >= 0 and j + d < m:
						if l[k][j - d] == '*' and l[k][j + d] == '*':
							vis[k][j - d] += 1
							vis[k][j + d] += 1
							d += 1
						else:
							break
				if d > t:
					vis[i][j] = 1
					continue
				else:
					d = 1
					for k in range(i - 1, -1, -1):
						if j - d >= 0 and j + d < m:
							if l[k][j - d] == '*' and l[k][j + d] == '*':
								vis[k][j - d] -= 1
								vis[k][j + d] -= 1
								d += 1
							else:
								break
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*' and vis[i][j] == 0:
				ans = 'NO'
	print(ans)


import sys
input = sys.stdin.readline

def print2(pet):
	for i in range(len(pet)):
		for j in range(len(pet[0])):
			print(pet[i][j], end=' ')
		print()
t = int(input())
for cnt in range(t):
	(n, m, k) = map(int, input().split())
	pet = [[]] * n
	ans = [[0] * m for _ in range(n)]
	for i in range(n):
		pet[i] = list(input()[:-1])
	for i in range(n):
		for j in range(m):
			if pet[i][j] == '.':
				continue
			mx = 0
			while i - mx >= 0 and j - mx >= 0 and (j + mx < m) and (pet[i - mx][j - mx] == pet[i - mx][j + mx]) and (pet[i - mx][j - mx] == '*'):
				mx = mx + 1
			for x in range(mx):
				ans[i - x][j - x] = max(ans[i - x][j - x], mx - 1)
				ans[i - x][j + x] = max(ans[i - x][j + x], mx - 1)
	bol = True
	for i in range(n):
		for j in range(m):
			if pet[i][j] == '*' and ans[i][j] < k:
				bol = False
	if bol:
		print('Yes')
	else:
		print('No')


import bisect
import collections
import copy
import fractions
import functools
import heapq
import math
import random
import sys

def _p(str):
	sys.stdout.write(str + '\n')

def _i():
	return sys.stdin.readline()

def draw_largest_tick_possible(n, m, k, field):
	tick_coords = []
	for d in range(200):
		if n - d == -1 or m - d == -1 or m + d >= len(field[0]) or (field[n - d][m - d] == '.') or (field[n - d][m + d] == '.'):
			break
		tick_coords.append((n - d, m - d))
		tick_coords.append((n - d, m + d))
	if len(tick_coords) / 2 > k:
		for (x, y) in tick_coords:
			field[x][y] = '-'
T = int(_i())
for t in range(T):
	(N, M, K) = tuple(map(int, _i().split()))
	field = []
	for n in range(N):
		field.append([ch for ch in _i().strip()])
	for n in range(N - 1, -1, -1):
		for m in range(M):
			if field[n][m] == '*' or field[n][m] == '-':
				draw_largest_tick_possible(n, m, K, field)
	if all((not any((ch == '*' for ch in row)) for row in field)):
		_p('YES')
	else:
		_p('NO')
sys.stdout.flush()


for nt in range(int(input())):
	(n, m, upper) = map(int, input().split())
	g = []
	d = []
	for i in range(n):
		g.append(list(input()))
		d.append([0] * m)
	for i in range(n):
		for j in range(m):
			if g[i][j] == '*' and d[i][j] == 0:
				maxx = -1
				for k in range(min(i, j, m - j - 1) + 1):
					if g[i - k][j - k] == '*' and g[i - k][j + k] == '*':
						maxx += 1
					else:
						break
				if maxx >= upper:
					d[i][j] = 1
					for k in range(maxx + 1):
						d[i - k][j - k] = 1
						d[i - k][j + k] = 1
	ans = 'YES'
	for i in range(n):
		for j in range(m):
			if g[i][j] == '*' and d[i][j] == 0:
				ans = 'NO'
				break
	print(ans)


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	original = []
	for i in range(n):
		a = list(input())
		original.append(a)
	temporary = [['.' for i in range(m)] for j in range(n)]
	for row in range(n):
		for column in range(m):
			if original[row][column] == '*':
				count_till_now = 0
				for times in range(1, row + 1):
					if column + times < m and column - times >= 0 and (original[row - times][column + times] == '*') and (original[row - times][column - times] == '*'):
						count_till_now = times
					else:
						break
				if count_till_now >= k:
					for i in range(count_till_now + 1):
						temporary[row - i][column - i] = '*'
						temporary[row - i][column + i] = '*'
	if temporary == original:
		print('YES')
	else:
		print('NO')