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")
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <complex>
#include <fstream>
#define ll long long
#define inf 1e9 + 8
#define sinf 1e17 + 500
#define ld long double
#define ull unsigned long long
#define pi acos(-1)
#define lp(a, b, c, d) for (ll a = b; a < c; a += d)
//#define endl '\n'
#define EPS 1e-12
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define mod 1000000007
using namespace std;
const ll N = 20, SEG = (1<<(int)(ceil(log2(N)) +1 ));
ll gcd(ll a , ll b )
{
if(b==0)return a ;
return gcd(b , a%b);
}
int n ,m , k ;
char gr[N][N];
int tallest(int r ,int c )
{
int pr = 1 ;
while(r-pr >=0 && c-pr >=0 && c+pr <m && (gr[r-pr][c-pr] == '*' ||gr[r-pr][c-pr] == '#') && (gr[r-pr][c+pr] == '*' ||gr[r-pr][c+pr] == '#') )
{
pr++;
}
return pr-1;
}
void ch(int r , int c ,int d)
{
gr[r][c]='#';
for(int i=1;i<=d;i++)
{
gr[r-i][c-i] = gr[r-i][c+i] = '#';
}
}
int main()
{
IO
int t ;
cin>>t;
while(t--)
{
cin>>n>>m>>k;
for(int i=0;i<n;i++)
{
cin>>gr[i];
}
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)if(gr[i][j]=='*')
{
int g = tallest(i,j);
if(g >= k)
{
ch(i,j,g);
// for(int i=0;i<n;i++)
// {
// cout<<gr[i]<<endl;
// }
// cout<<endl;
}
}
}
bool res =1 ;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(gr[i][j]=='*')
{
res = 0 ;
goto br;
}
}
}
br:
cout<<(res ? "YES" : "NO")<<endl;
}
return 0;
}
1299A - Anu Has a Function | 1111A - Superhero Transformation |
954A - Diagonal Walking | 39F - Pacifist frogs |
1451C - String Equality | 386A - Second-Price Auction |
1690E - Price Maximization | 282B - Painting Eggs |
440A - Forgotten Episode | 233B - Non-square Equation |
628B - New Skateboard | 262B - Roma and Changing Signs |
755C - PolandBall and Forest | 456B - Fedya and Maths |
376B - IOU | 1623B - Game on Ranges |
1118A - Water Buying | 1462C - Unique Number |
301A - Yaroslav and Sequence | 38A - Army |
38C - Blinds | 1197A - DIY Wooden Ladder |
1717D - Madoka and The Corruption Scheme | 1296D - Fight with Monsters |
729D - Sea Battle | 788A - Functions again |
1245B - Restricted RPS | 1490D - Permutation Transformation |
1087B - Div Times Mod | 1213B - Bad Prices |