You have a given picture with size $w \times h$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below:

  A "+" shape has one center nonempty cell.  There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In other words, there should be a ray in each direction.  All other cells are empty. 

Find out if the given picture has single "+" shape.


-----Input-----

The first line contains two integers $h$ and $w$ ($1 \le h$, $w \le 500$) — the height and width of the picture.

The $i$-th of the next $h$ lines contains string $s_{i}$ of length $w$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space.


-----Output-----

If the given picture satisfies all conditions, print "YES". Otherwise, print "NO".

You can output each letter in any case (upper or lower).


-----Examples-----
Input
5 6
......
..*...
.****.
..*...
..*...

Output
YES

Input
3 5
..*..
****.
.*...

Output
NO

Input
7 7
.......
...*...
..****.
...*...
...*...
.......
.*.....

Output
NO

Input
5 6
..**..
..**..
******
..**..
..**..

Output
NO

Input
3 7
.*...*.
***.***
.*...*.

Output
NO

Input
5 10
..........
..*.......
.*.******.
..*.......
..........

Output
NO



-----Note-----

In the first example, the given picture contains one "+".

In the second example, two vertical branches are located in a different column.

In the third example, there is a dot outside of the shape.

In the fourth example, the width of the two vertical branches is $2$.

In the fifth example, there are two shapes.

In the sixth example, there is an empty space inside of the shape.

Difficulty: EASY
Tags: String algorithms

Graph traversal

Implementation

Starter code:

Solutions:
import sys
input = sys.stdin.readline
(h, w) = map(int, input().split())
l = [list(input().strip()) for _ in range(h)]
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
i = 0
j = 0
(first_i, first_j) = (-1, -1)
for i in range(h):
	for j in range(w):
		if l[i][j] == '*':
			first_i = i
			first_j = j
			break
	if first_j != -1:
		break
if first_i == -1:
	print('NO')
else:
	direction = -1
	for k in range(4):
		ni = i + dx[k]
		nj = j + dy[k]
		if 0 <= ni < h and 0 <= nj < w and (l[ni][nj] == '*'):
			direction = k
	if direction == -1:
		print('NO')
	else:
		(center_i, center_j) = (-1, -1)
		(i, j) = (first_i, first_j)
		pcl1 = (direction + 1) % 4
		pcl2 = (direction + 3) % 4
		while True:
			l[i][j] = '.'
			pi = i + dx[pcl1]
			pj = j + dy[pcl1]
			if 0 <= pi < h and 0 <= pj < w and (l[pi][pj] == '*'):
				pi = i + dx[pcl2]
				pj = j + dy[pcl2]
				if 0 <= pi < h and 0 <= pj < w and (l[pi][pj] == '*'):
					if center_i != -1:
						print('NO')
						sys.exit()
					else:
						center_i = i
						center_j = j
				else:
					print('NO')
					sys.exit()
			ni = i + dx[direction]
			nj = j + dy[direction]
			if not (0 <= ni < h and 0 <= nj < w and (l[ni][nj] == '*')):
				(end_i, end_j) = (i, j)
				break
			(i, j) = (ni, nj)
		if center_i == -1:
			print('NO')
			sys.exit()
		if (first_i, first_j) != (center_i, center_j) and (end_i, end_j) != (center_i, center_j):
			i = center_i
			j = center_j
			while True:
				pi = i + dx[pcl1]
				pj = j + dy[pcl1]
				if 0 <= pi < h and 0 <= pj < w and (l[pi][pj] == '*'):
					l[pi][pj] = '.'
				else:
					break
				i = pi
				j = pj
			i = center_i
			j = center_j
			while True:
				pi = i + dx[pcl2]
				pj = j + dy[pcl2]
				if 0 <= pi < h and 0 <= pj < w and (l[pi][pj] == '*'):
					l[pi][pj] = '.'
				else:
					break
				i = pi
				j = pj
		else:
			print('NO')
			sys.exit()
		for i in range(h):
			for j in range(w):
				if l[i][j] != '.':
					print('NO')
					sys.exit()
		print('YES')


(h, w) = map(int, input().split())
s = []
for _ in range(h):
	s.append(input())

def get_si_info(si):
	j1 = si.find('*')
	if j1 < 0:
		return (-1, -1)
	j2 = si.rfind('*')
	for j in range(j1 + 1, j2):
		if si[j] != '*':
			return (None, None)
	return (j1, j2)

def get_ans():
	if h < 3 or w < 3:
		return False
	i = 0
	mid_j = -1
	while i < h:
		(j1, j2) = get_si_info(s[i])
		if j1 is None or j1 != j2:
			return False
		if j1 != -1:
			mid_j = j1
			break
		i += 1
	if mid_j < 0:
		return False
	i += 1
	mid_i = -1
	while i < h:
		(j1, j2) = get_si_info(s[i])
		if j1 is None or j1 == -1:
			return False
		if j1 != mid_j or j2 != mid_j:
			if j1 >= mid_j or j2 <= mid_j:
				return False
			mid_i = i
			break
		i += 1
	if mid_i < 0:
		return False
	i += 1
	while i < h:
		(j1, j2) = get_si_info(s[i])
		if j1 is None:
			return False
		if j1 != mid_j or j2 != mid_j:
			break
		i += 1
	if i <= mid_i + 1:
		return False
	while i < h:
		(j1, j2) = get_si_info(s[i])
		if j1 is None:
			return False
		if j1 != -1 or j2 != -1:
			return False
		i += 1
	return True
print('YES' if get_ans() else 'NO')


def dfn():
	(r, c) = map(int, input().split())
	ar = []
	if r < 3 or c < 3:
		return -1
	mns = -1
	ck = 0
	pvl = -1
	hu = ar.append
	oin = -1
	for i in range(r):
		tp = input()
		hu(tp)
		k = tp.count('*')
		if k == 1:
			if pvl == -1:
				oin = tp.index('*')
				if oin == 0 or oin == c - 1:
					return -10
			elif pvl != i - 1 or tp[oin] != '*':
				return -2
			pvl = i
		elif k == 2:
			return -3
		elif k > 2:
			if pvl == -1 or i == c - 1:
				return -9
			if ck == 1:
				return -4
			n = tp.index('*')
			while n < c and tp[n] == '*':
				n += 1
			for p in range(n + 1, c):
				if tp[p] == '*':
					return -5
			ck = 1
			pvl = i
			mns = i
	if mns == -1 or oin == -1 or ar[mns][oin + 1] != '*' or (ar[mns + 1][oin] != '*') or (ar[mns - 1][oin] != '*') or (ar[mns][oin - 1] != '*'):
		return -8
	return 0
jn = 'YES' if dfn() == 0 else 'NO'
print(jn)


(n, m) = map(int, input().split())
a = [[i == '*' for i in input()] for j in range(n)]
t = ()
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if a[i][j] and a[i][j + 1] and a[i][j - 1] and a[i + 1][j] and a[i - 1][j]:
			if not t:
				t = (i, j)
			else:
				print('NO')
				return
if not t:
	print('NO')
	return
for i in range(t[0], -1, -1):
	if a[i][t[1]]:
		a[i][t[1]] = False
	else:
		break
for i in range(t[0] + 1, n):
	if a[i][t[1]]:
		a[i][t[1]] = False
	else:
		break
for i in range(t[1] - 1, -1, -1):
	if a[t[0]][i]:
		a[t[0]][i] = False
	else:
		break
for i in range(t[1] + 1, m):
	if a[t[0]][i]:
		a[t[0]][i] = False
	else:
		break
for el in a:
	for ell in el:
		if ell:
			print('NO')
			return
print('YES')


(H, W) = map(int, input().split())
X = [[[0, 1][a == '*'] for a in input()] for i in range(H)]

def main():
	s = sum([sum(x) for x in X])
	(h, w) = (-1, -1)
	for i in range(H):
		for j in range(W):
			if X[i][j]:
				w = j
				break
		if w >= 0:
			break
	else:
		return 0
	for j in range(W):
		for i in range(H):
			if X[i][j]:
				h = i
				break
		if h >= 0:
			break
	else:
		return 0
	if X[h][w] == 0:
		return 0
	c = 1
	for (di, dj) in [(0, 1), (0, -1), (1, 0), (-1, 0)]:
		(i, j) = (h, w)
		if 0 <= i + di < H and 0 <= j + dj < W:
			if X[i + di][j + dj] == 0:
				return 0
		else:
			return 0
		while 0 <= i + di < H and 0 <= j + dj < W:
			i += di
			j += dj
			if X[i][j] == 0:
				break
			c += 1
	if s == c:
		return 1
	return 0
if main():
	print('YES')
else:
	print('NO')


import os
(n, m) = map(int, input().split())
s = [''] * n
x = 0
p = -1
for i in range(n):
	s[i] = input()
	if s[i].count('*') > 1:
		x += 1
		p = i
if x != 1:
	print('NO')
else:
	i = 0
	while i < m and s[p][i] == '.':
		i += 1
	st = i
	i = m - 1
	while i >= 0 and s[p][i] == '.':
		i -= 1
	ed = i
	for i in range(st, ed + 1):
		if s[p][i] == '.':
			print('NO')
			quit()
	i = p - 1
	while i >= 0:
		if s[i].find('*') == -1:
			break
		elif i - 1 >= 0 and s[i - 1].find('*') != -1:
			if s[i].find('*') != s[i - 1].find('*'):
				print('NO')
				quit()
		i -= 1
	i -= 1
	while i >= 0:
		if s[i].find('*') >= 0:
			print('NO')
			quit()
		i -= 1
	i = p + 1
	while i < n:
		if s[i].find('*') == -1:
			break
		elif i + 1 < n and s[i + 1].find('*') != -1:
			if s[i].find('*') != s[i + 1].find('*'):
				print('NO')
				quit()
		i += 1
	i += 1
	while i < n:
		if s[i].find('*') >= 0:
			print('NO')
			quit()
		i += 1
	if p - 1 < 0 or p + 1 >= n or s[p - 1].find('*') == -1 or (s[p + 1].find('*') == -1) or (s[p - 1].find('*') != s[p + 1].find('*')) or (s[p + 1].find('*') == st) or (s[p + 1].find('*') == ed):
		print('NO')
		quit()
	print('YES')


(r, c) = list(map(int, input().split()))
s = []
for i in range(r):
	s.append(list(input()))
found = False
for i in range(1, r - 1):
	if found:
		break
	for j in range(1, c - 1):
		if s[i][j] != '*' or s[i - 1][j] != '*' or s[i][j - 1] != '*' or (s[i + 1][j] != '*') or (s[i][j + 1] != '*'):
			continue
		found = True
		for k in range(i, -1, -1):
			if s[k][j] != '*':
				break
			s[k][j] = '.'
		for k in range(i + 1, r):
			if s[k][j] != '*':
				break
			s[k][j] = '.'
		for k in range(j + 1, c):
			if s[i][k] != '*':
				break
			s[i][k] = '.'
		for k in range(j - 1, -1, -1):
			if s[i][k] != '*':
				break
			s[i][k] = '.'
		break
if any((any((c == '*' for c in p)) for p in s)) or not found:
	print('No')
else:
	print('Yes')


(n, m) = list(map(int, input().split()))
seen = [[False] * m for _ in range(n)]
mat = [input() for _ in range(n)]

def is_cross(i, j):
	if i == 0 or i == n - 1 or j == 0 or (j == m - 1) or (mat[i - 1][j] != '*') or (mat[i + 1][j] != '*') or (mat[i][j - 1] != '*') or (mat[i][j + 1] != '*'):
		return (False, None, None)
	else:
		top = i - 1
		bot = i + 1
		left = j - 1
		right = j + 1
		while top > 0 and mat[top - 1][j] == '*':
			top -= 1
		while left > 0 and mat[i][left - 1] == '*':
			left -= 1
		while bot < n - 1 and mat[bot + 1][j] == '*':
			bot += 1
		while right < m - 1 and mat[i][right + 1] == '*':
			right += 1
		return (True, [[top, bot], [left, right]], (i, j))
found = False
for i in range(n):
	for j in range(m):
		if mat[i][j] == '*':
			(is_a_cross, sizes, center) = is_cross(i, j)
			if is_a_cross:
				found = True
				break
	if found:
		break
answered = False
if found:
	(top, bot) = sizes[0]
	(left, right) = sizes[1]
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '*':
				if i == center[0]:
					if j not in list(range(left, right + 1)):
						print('NO')
						answered = True
				elif j == center[1]:
					if i not in list(range(top, bot + 1)):
						print('NO')
						answered = True
				else:
					print('NO')
					answered = True
			if answered:
				break
		if answered:
			break
	if not answered:
		print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline
(a, b) = list(map(int, input().split()))
if a < 3 or b < 3:
	print('NO')
	exit()
n = []
center = False
r = -1
c = -1
strs = 0
for i in range(a):
	n.append(input())
	strs += n[i].count('*')
for i in range(1, a - 1):
	for j in range(1, b - 1):
		if n[i][j] == '*' and n[i - 1][j] == '*' and (n[i + 1][j] == '*') and (n[i][j - 1] == '*') and (n[i][j + 1] == '*'):
			r = i
			c = j
			break
if r == -1 and c == -1:
	print('NO')
	exit()
s = 1
for i in range(r - 1, -1, -1):
	if n[i][c] == '*':
		s += 1
	else:
		break
for i in range(r + 1, a):
	if n[i][c] == '*':
		s += 1
	else:
		break
for i in range(c - 1, -1, -1):
	if n[r][i] == '*':
		s += 1
	else:
		break
for i in range(c + 1, b):
	if n[r][i] == '*':
		s += 1
	else:
		break
if s == strs:
	print('YES')
else:
	print('NO')


def plusAndPicture(h, w, mlst):
	if h < 3 or w < 3:
		return 'NO'
	for i in range(1, h - 1):
		if mlst[i].count('*') >= 3:
			f = mlst[i].index('*')
			l = ''.join(mlst[i]).rindex('*')
			if mlst[i].count('*') == l - f + 1:
				j = i - 1
				if mlst[j].count('*') == 1:
					if mlst[j].index('*') > f and mlst[j].index('*') < l:
						pctr = mlst[j].index('*')
					else:
						return 'NO'
				else:
					return 'NO'
				j = i + 1
				if mlst[j].count('*') == 1 and mlst[j].index('*') == pctr:
					pass
				else:
					return 'NO'
			else:
				return 'NO'
			p = i - 1
			while p >= 0:
				if mlst[p].count('*') == 1:
					if mlst[p].index('*') == pctr:
						p = p - 1
					else:
						return 'NO'
				elif mlst[p].count('*') == 0:
					while p >= 0:
						if mlst[p].count('*') == 0:
							p = p - 1
						else:
							return 'NO'
					break
				else:
					return 'NO'
			p = i + 1
			while p < h:
				if mlst[p].count('*') == 1:
					if mlst[p].index('*') == pctr:
						p = p + 1
					else:
						return 'NO'
				elif mlst[p].count('*') == 0:
					while p < h:
						if mlst[p].count('*') == 0:
							p = p + 1
						else:
							return 'NO'
					break
				else:
					return 'NO'
			return 'YES'
	return 'NO'
(h, w) = map(int, input().rstrip().split())
mlst = []
for _ in range(h):
	mlst.append(list(input()))
print(plusAndPicture(h, w, mlst))


(a, b) = [int(i) for i in input().split()]
y = 0
flag = False
flag1 = False
flag2 = False
while True:
	st = input()
	y += 1
	if st.count('*') > 0:
		if st.count('*') > 1:
			print('NO')
			exit()
		x = st.index('*')
		break
	if y == a:
		print('NO')
		exit()
if x == 0 or x == b - 1:
	print('NO')
	exit()
for i in range(y, a):
	st = input()
	if st.count('*') > 1 and flag:
		print('NO')
		exit()
	if flag2 and st.count('*') == 0:
		print('NO')
		exit()
	else:
		flag2 = False
	if st.count('*') > 1:
		st = st[st.find('*'):st.rfind('*') + 1]
		if len(st) < 3:
			print('NO')
			exit()
		if st.count('.') > 0:
			print('NO')
			exit()
		if i == a - 1:
			print('NO')
			exit()
		flag = True
		flag2 = True
	if st.count('*') == 0:
		if not flag:
			print('NO')
			exit()
		else:
			flag1 = True
	if st.count('*') == 1:
		if st.index('*') != x or flag1:
			print('NO')
			exit()
if not flag:
	print('NO')
	exit()
print('YES')


dr = [0, 0, -1, 1]
dc = [-1, 1, 0, 0]
maxx = 501

class Cell:

	def __init__(self, r, c):
		self.c = c
		self.r = r
matrix = [] * maxx
cnt = 0
count = 0
(m, n) = map(int, input().split())
for i in range(m):
	tmp = list(input())
	matrix.append(tmp)
for i in range(1, m - 1):
	for j in range(1, n - 1):
		if matrix[i][j] == '*' and matrix[i][j - 1] == '*' and (matrix[i][j + 1] == '*') and (matrix[i - 1][j] == '*') and (matrix[i + 1][j] == '*'):
			up = i - 1
			while up >= 0 and matrix[up][j] == '*':
				cnt += 1
				up -= 1
			down = i + 1
			while down < m and matrix[down][j] == '*':
				cnt += 1
				down += 1
			left = j - 1
			while left >= 0 and matrix[i][left] == '*':
				cnt += 1
				left -= 1
			right = j + 1
			while right < n and matrix[i][right] == '*':
				cnt += 1
				right += 1
			cnt += 1
		if cnt > 0:
			break
	if cnt > 0:
		break
for i in range(m):
	for j in range(n):
		if matrix[i][j] == '*':
			count += 1
if cnt == count and count != 0:
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline
(h, w) = map(int, input().split())
MAP = [list(input()) for i in range(h)]
flag = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if MAP[i][j] == MAP[i - 1][j] == MAP[i + 1][j] == MAP[i][j - 1] == MAP[i][j + 1] == '*':
			CI = i
			CJ = j
			flag = 1
			break
	if flag == 1:
		break
if flag == 0:
	print('NO')
	sys.exit()
LIST = [[0] * w for i in range(h)]
for i in range(CI, -1, -1):
	if MAP[i][CJ] == '*':
		LIST[i][CJ] = 1
	else:
		break
for i in range(CI, h):
	if MAP[i][CJ] == '*':
		LIST[i][CJ] = 1
	else:
		break
for j in range(CJ, -1, -1):
	if MAP[CI][j] == '*':
		LIST[CI][j] = 1
	else:
		break
for j in range(CJ, w):
	if MAP[CI][j] == '*':
		LIST[CI][j] = 1
	else:
		break
for i in range(h):
	for j in range(w):
		if MAP[i][j] == '*' and LIST[i][j] == 0:
			print('NO')
			sys.exit()
print('YES')


import sys
(H, W) = map(int, sys.stdin.readline().rstrip().split())
picture = [sys.stdin.readline().rstrip() for h in range(H)]
answer = 'YES'
if W < 3 or H < 3:
	print('NO')
else:
	is_cross = dict()
	dx = [-1, 0, 1, 0]
	dy = [1, 1, 1, 2]

	def check_cross(row, col):
		r = row
		c = col
		for i in range(4):
			if picture[r + dy[i]][col + dx[i]] != '*':
				return False
		while r < H and picture[r][col] == '*':
			is_cross[r, col] = True
			r += 1
		r = row
		while r >= 0 and picture[r][col] == '*':
			is_cross[r, col] = True
			r -= 1
		row += 1
		while c < W and picture[row][c] == '*':
			is_cross[row, c] = True
			c += 1
		c = col
		while c >= 0 and picture[row][c] == '*':
			is_cross[row, c] = True
			c -= 1
		return True

	def check_whole():
		global answer
		for hh in range(H):
			for ww in range(W):
				if picture[hh][ww] == '*' and (hh, ww) not in is_cross.keys():
					answer = 'NO'
					return
				elif picture[hh][ww] == '.' and (hh, ww) in is_cross.keys():
					answer = 'NO'
					return
	for h in range(0, H - 2):
		for w in range(1, W - 1):
			if picture[h][w] == '*':
				if check_cross(h, w):
					check_whole()
					print(answer)
					exit(0)
	answer = 'NO'
	print(answer)


a = [input() for _ in [0] * int(input().split()[0])]

def f(a):
	try:
		((x, y, z, _), u) = {(x.index('*'), x[::-1].index('*'), x.count('*'), -len(x)): 0 for x in a if '*' in x}
	except:
		z = 2
	return z > 1 or x <= u[0] or y <= u[1] or (sum(u) < 0)
print('YNEOS'[f(a) | f(zip(*a))::2])


def stepbyi(x, y, a, h, w):
	while -1 < x < h and -1 < y < w:
		if M[x][y] == '.':
			break
		M[x][y] = '.'
		x += a

def stepbyj(x, y, a, h, w):
	while -1 < x < h and -1 < y < w:
		if M[x][y] == '.':
			break
		M[x][y] = '.'
		y += a
(h, w) = map(int, input().split())
M = [list(input()) for i in range(h)]
k = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if M[i][j] == M[i - 1][j] == M[i + 1][j] == M[i][j - 1] == M[i][j + 1] == '*':
			k = 1
			break
	if k == 1:
		break
from sys import exit
if k == 0:
	print('NO')
	exit()
M[i][j] = '.'
stepbyi(i - 1, j, -1, h, w)
stepbyi(i + 1, j, 1, h, w)
stepbyj(i, j - 1, -1, h, w)
stepbyj(i, j + 1, 1, h, w)
k = 0
for (i, x) in enumerate(M):
	for (j, y) in enumerate(x):
		if y == '*':
			print('NO')
			exit()
print('YES')


from collections import Counter
(h, w) = map(int, input().split())
state = 1
a = '.' * w
for _ in range(h):
	s = input()
	if state == 1:
		if s == a:
			continue
		c = Counter(s)
		if c['*'] > 1:
			print('NO')
			break
		b = s
		state += 1
	elif state == 2:
		if s == b:
			continue
		bb = list(map(len, b.split('*')))
		cc = list(map(len, s.split('*')))
		if sum(cc) > cc[0] + cc[-1] or bb[0] <= cc[0] or bb[-1] <= cc[-1]:
			print('NO')
			break
		state += 1
	elif state == 3:
		if s != b:
			print('NO')
			break
		state += 1
	elif state == 4:
		if s == b:
			continue
		elif s == a:
			state += 1
		else:
			print('NO')
			break
	elif state == 5:
		if s != a:
			print('NO')
			break
	else:
		print('NO')
		break
else:
	if state < 4:
		print('NO')
	else:
		print('YES')


(w, h) = map(int, input().split())
sas = -4
f = 0
G = 0
U = 0
z = 0
popa = 0
Rer = 0
d1 = 10 ** 4
A = [input().split() for _ in range(w)]
for S in A:
	x = ''.join(S).find('*')
	y = ''.join(S).rfind('*')
	if not x == -1:
		for elem in range(x, y + 1):
			if S[0][elem] == '.':
				print('NO')
				exit(0)
	if x == y and (not x == -1):
		if G:
			Rer = 1
		z = 1
		popa = 1
		if f:
			print('NO')
			exit(0)
		if sas == -4 and U <= x <= d1:
			sas = x
		elif not sas == x:
			print('NO')
			exit(0)
	elif x == -1 and y == -1:
		if not sas == -4:
			f = 1
	else:
		if z == 0:
			print('NO')
			exit(0)
		popa = 1
		(U, d1) = (x, y)
		if G:
			print('NO')
			exit(0)
		G = 1
if popa and d1 - U >= 2 and Rer:
	print('YES')
else:
	print('NO')


dx = [-1, 0, 1]
dy = [-1, 0, 1]
n = 0
m = 0

def check(ii, jj, picture):
	for i in dx:
		for j in dy:
			if abs(i) + abs(j) > 1:
				continue
			[x, y] = [ii + i, jj + j]
			if x < 0 or y < 0 or x >= n or (y >= m) or (picture[x][y] != '*'):
				return -1
	return 1
[n, m] = [int(x) for x in input().split()]
picture = [[] for x in range(n)]
for i in range(n):
	picture[i] = [cc for cc in input()]
star = 0
for i in range(n):
	for ch in picture[i]:
		if ch == '*':
			star += 1
res = 'NO'
for i in range(n):
	for j in range(m):
		if check(i, j, picture) == 1:
			c = 0
			for k in range(i - 1, -1, -1):
				if picture[k][j] == '*':
					c += 1
				else:
					break
			for k in range(i + 1, n, 1):
				if picture[k][j] == '*':
					c += 1
				else:
					break
			for k in range(j - 1, -1, -1):
				if picture[i][k] == '*':
					c += 1
				else:
					break
			for k in range(j + 1, m, 1):
				if picture[i][k] == '*':
					c += 1
				else:
					break
			if c == star - 1:
				res = 'YES'
			n = 0
			m = 0
print(res)


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	arr.append(list(input()))
ok = False
for i in range(n):
	for j in range(m):
		if i + 1 < n and j + 1 < m and (i - 1 >= 0) and (j - 1 >= 0):
			if arr[i][j] == '*' and arr[i][j + 1] == '*' and (arr[i][j - 1] == '*') and (arr[i - 1][j] == '*') and (arr[i + 1][j] == '*'):
				x = j + 1
				while x < m and arr[i][x] != '.':
					arr[i][x] = '.'
					x += 1
				x = j - 1
				while x >= 0 and arr[i][x] != '.':
					arr[i][x] = '.'
					x -= 1
				x = i + 1
				while x < n and arr[x][j] != '.':
					arr[x][j] = '.'
					x += 1
				x = i - 1
				while x >= 0 and arr[x][j] != '.':
					arr[x][j] = '.'
					x -= 1
				arr[i][j] = '.'
				ok = True
		if ok:
			break
	if ok:
		break
if not ok:
	print('NO')
else:
	ok = True
	for i in range(n):
		for j in range(m):
			ok &= arr[i][j] == '.'
	if ok:
		print('YES')
	else:
		print('NO')


import sys
(n, m) = map(int, input().split())
grid = []
stars = []
for r in range(n):
	grid.append([])
	for c in range(m):
		if sys.stdin.read(1) == '*':
			stars.append((r, c))
			grid[-1].append(1)
		else:
			grid[-1].append(0)
	sys.stdin.read(1)
rc = {}
cc = {}
for (r, c) in stars:
	rc[r] = rc.get(r, 0) + 1
	cc[c] = cc.get(c, 0) + 1
if len(rc) != 1 + list(rc.values()).count(1):
	print('NO')
elif len(cc) != 1 + list(cc.values()).count(1):
	print('NO')
else:
	x = [i for i in rc if rc[i] > 1][0]
	y = [i for i in cc if cc[i] > 1][0]
	center = (x, y)
	try:
		if not (grid[x - 1][y] and grid[x + 1][y] and grid[x][y - 1] and grid[x][y + 1]):
			print('NO')
		else:
			count = 0
			for delta in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
				(cx, cy) = center
				while 0 <= cx < n and 0 <= cy < m and grid[cx][cy]:
					(cx, cy) = (cx + delta[0], cy + delta[1])
					count += 1
			if len(stars) == count - 3:
				print('YES')
			else:
				print('NO')
	except:
		print('NO')


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

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

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

def si():
	return input()
(h, w) = mi()
a = []
for i in range(h):
	s = si()
	a.append(s)
x = []
for i in range(h):
	for j in range(w):
		if a[i][j] == '*':
			x.append([i, j])
f = 0
for i in range(len(x)):
	j = x[i][0]
	k = x[i][1]
	if j < 1 or k < 1:
		continue
	if j > h - 2 or k > w - 2:
		continue
	if a[j][k - 1] == '*' and a[j - 1][k] == '*' and (a[j + 1][k] == '*') and (a[j][k + 1] == '*'):
		f = 1
		break
if f:
	f1 = 0
	for i in range(j - 1, -1, -1):
		if a[i][k] == '*':
			if f1:
				f = 0
				break
		else:
			f1 = 1
	f1 = 0
	for i in range(k - 1, -1, -1):
		if a[j][i] == '*':
			if f1:
				f = 0
				break
		else:
			f1 = 1
	f1 = 0
	for i in range(j + 1, h):
		if a[i][k] == '*':
			if f1:
				f = 0
				break
		else:
			f1 = 1
	f1 = 0
	for i in range(k + 1, w):
		if a[j][i] == '*':
			if f1:
				f = 0
				break
		else:
			f1 = 1
if f == 1:
	f = 0
	for i in range(h):
		if i == j:
			continue
		for k1 in range(w):
			if k1 == k:
				continue
			if a[i][k1] == '*':
				f = 1
				break
	if f == 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import math
from decimal import Decimal

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
(n, m) = map(int, input().split())
a = []
for i in range(n):
	s = input()
	a.append(s)
kp = 0
kpn = 0
ob = 0
for i in range(n):
	if a[i][0] == '*':
		ob += 1
for i in range(n):
	if a[i][m - 1] == '*':
		ob += 1
for j in range(m):
	if a[0][j] == '*':
		ob += 1
for j in range(m):
	if a[n - 1][j] == '*':
		ob += 1
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if a[i][j] == '*':
			ob += 1
		if a[i][j] == '*' and a[i - 1][j] == '*' and (a[i + 1][j] == '*') and (a[i][j + 1] == '*') and (a[i][j - 1] == '*'):
			kp += 1
			kpn += 1
			d = i - 1
			while a[d][j] == '*' and d >= 0:
				kpn += 1
				d -= 1
			d = i + 1
			while d < n and a[d][j] == '*':
				d += 1
				kpn += 1
			d = j - 1
			while d >= 0 and a[i][d] == '*':
				kpn += 1
				d -= 1
			d = j + 1
			while d < m and a[i][d] == '*':
				kpn += 1
				d += 1
if kp == 1 and kpn == ob:
	print('YES')
else:
	print('NO')


(n, m) = [int(p) for p in input().split()]
grid = []
for _ in range(n):
	grid.append(list(input()))
cntr = []
visited = []
for i in range(n):
	visited.append([True] * m)
for i in range(n):
	for j in range(m):
		if grid[i][j] == '*':
			visited[i][j] = False
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if grid[i][j] == '*' and grid[i - 1][j] == '*' and (grid[i + 1][j] == '*') and (grid[i][j + 1] == '*') and (grid[i][j - 1] == '*'):
			cntr.append((i, j))
if not cntr:
	print('NO')
elif len(cntr) > 1:
	print('NO')
else:
	(x, y) = cntr[0]
	while x >= 0 and grid[x][y] == '*':
		visited[x][y] = True
		x -= 1
	(x, y) = cntr[0]
	while x < n and grid[x][y] == '*':
		visited[x][y] = True
		x += 1
	(x, y) = cntr[0]
	while y >= 0 and grid[x][y] == '*':
		visited[x][y] = True
		y -= 1
	(x, y) = cntr[0]
	while y < m and grid[x][y] == '*':
		visited[x][y] = True
		y += 1
	ok = True
	for i in visited:
		for j in i:
			if not j:
				print('NO')
				ok = False
				exit()
	if ok:
		print('YES')


(a, b) = [int(x) for x in input().split()]
m = []
for i in range(a):
	m.append(input())
if a < 3 or b < 3:
	print('NO')
else:
	flag = False
	for i in range(1, a - 1):
		for j in range(1, b - 1):
			if m[i][j] == '*' and m[i - 1][j] == '*' and (m[i + 1][j] == '*') and (m[i][j - 1] == '*') and (m[i][j + 1] == '*'):
				flag = True
				break
		if flag:
			break
	row = ''.join(m[i])
	col = ''.join([x[j] for x in m])
	row_count = row.count('*')
	col_count = col.count('*')
	all_count = ''.join(m).count('*')
	if set(row.strip('.')) == {'*'} and set(col.strip('.')) == {'*'} and (all_count >= 5) and (row_count >= 3) and (col_count >= 3) and (row_count + col_count - 1 == all_count):
		print('YES')
	else:
		print('NO')


def fun(r, c):
	a = []
	for i in range(r):
		a.append(input())
	d = dict()
	m = set()
	ll = 0
	x = []
	ind = 0
	cc = 0
	lastin = 0
	lt = []
	for i in range(r):
		d[i] = []
		for j in range(c):
			if a[i][j] == '*':
				d[i].append([i, j])
		ll = len(d[i])
		if ll >= 1:
			if ll == 1:
				x.append(d[i][0])
				cc = d[i][0][1]
			if ll > 1:
				lt = d[i]
				lastin = i
				for j in d[i]:
					ind += 1
					if j[1] == cc:
						x.append(j)
						break
			m.add(ll)
			if len(m) > 2:
				return 'NO'
	ll = len(x)
	i = 1
	if ll < 3:
		return 'NO'
	if lastin == x[-1][0]:
		return 'NO'
	while i < ll:
		if x[i][0] - x[i - 1][0] > 1:
			return 'NO'
		if x[i][1] != x[i - 1][1]:
			return 'NO'
		i += 1
	inn = 1
	lll = len(lt)
	if lll < 2 or ind < 2 or lll - ind < 1:
		return 'NO'
	while inn < lll:
		if lt[inn - 1][1] + 1 != lt[inn][1]:
			return 'NO'
		inn += 1
	return 'YES'
x = list(map(int, input().split()))
print(fun(x[0], x[1]))


(m, n) = map(int, input().split())
s = []
f = 0
(a, b) = (0, 0)
for i in range(m):
	s.append(list(input()))
for i in range(1, m - 1):
	for j in range(1, n - 1):
		if s[i][j] == '*' and s[i + 1][j] == '*' and (s[i][j + 1] == '*') and (s[i - 1][j] == '*') and (s[i][j - 1] == '*'):
			f = 1
			break
	if f:
		(a, b) = (i, j)
		break
f2 = 0
if f:
	for i in range(m):
		for j in range(n):
			if i != a and j != b:
				if s[i][j] == '*':
					f2 = 1
					print('NO')
					break
		if f2:
			break
	if f2 == 0:
		maxcnt = 0
		cnt = 0
		for i in range(n):
			if s[a][i] == '*':
				cnt += 1
				maxcnt = max(cnt, maxcnt)
			else:
				cnt = 0
		if maxcnt != s[a].count('*'):
			f = 0
		if f:
			maxcnt = 0
			cnt = 0
			sc = [s[x][b] for x in range(m)]
			for i in range(m):
				if s[i][b] == '*':
					cnt += 1
					maxcnt = max(cnt, maxcnt)
				else:
					cnt = 0
			if maxcnt != sc.count('*'):
				f = 0
		if f == 0:
			print('NO')
		else:
			print('YES')
else:
	print('NO')


from itertools import groupby
(n, m) = map(int, input().split())
a = [list(input()) for i in range(n)]
b = list(map(list, zip(*a)))

def get_good_rows(a):
	return [i for i in range(len(a)) if a[i].count('*') > 2 and next(zip(*groupby(a[i]))).count('*') == 1]
good_rows = get_good_rows(a)
good_cols = get_good_rows(b)
result = 'NO'
if good_rows and good_cols and (a[good_rows[0]].count('*') + b[good_cols[0]].count('*') - 1 == sum([row.count('*') for row in a])) and (a[good_rows[0]].index('*') < good_cols[0] < m - a[good_rows[0]][-1::-1].index('*') - 1) and (b[good_cols[0]].index('*') < good_rows[0] < n - b[good_cols[0]][-1::-1].index('*') - 1):
	result = 'YES'
print(result)


from math import *
from collections import *
from itertools import *
from functools import *
from random import *

def getl(t=int):
	return [t(x) for x in input().split()]

def get(t=int):
	return t(input())
alphabet = [chr(x) for x in range(ord('a'), ord('z') + 1)]
alnum = lambda x: ord(x) - ord('a')

def main():
	(n, m) = getl()
	grid = []
	for i in range(n):
		grid += [input()]
	sum_i = [0] * n
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*':
				sum_i[i] += 1
	sum_j = [0] * m
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*':
				sum_j[j] += 1
	(c1, r1) = check(sum_i)
	(c2, r2) = check(sum_j)
	if c1 and c2 and (grid[r1][r2] == '*'):
		print('YES')
	else:
		print('NO')

def check(sum_i):
	i = 0
	happen_1 = False
	happen_2 = False
	happen_3 = False
	r = -1
	while i < len(sum_i) and sum_i[i] == 0:
		i += 1
	while i < len(sum_i) and sum_i[i] == 1:
		happen_1 = True
		i += 1
	while i < len(sum_i) and sum_i[i] > 1:
		if happen_2:
			return (False, 0)
		happen_2 = True
		r = i
		i += 1
	while i < len(sum_i) and sum_i[i] == 1:
		happen_3 = True
		i += 1
	while i < len(sum_i) and sum_i[i] == 0:
		i += 1
	if i != len(sum_i):
		return (False, 0)
	return (happen_1 and happen_2 and happen_3, r)
main()


t = input().split()
k = int(t[0])
a = 0
b = 0
d = 0
e = 0
m = 0
emon = []
rt = 0
for i in range(k):
	string = input()
	c = string.count('*')
	if c == 1:
		f = string.find('*')
		emon.append(f)
		a += 1
	elif c > 2 and a > 0:
		b += 1
		if string[f] == '*' and string[f - 1] == '*' and (string[f + 1] == '*'):
			a = 0
			m = 1
			k = i
			rt = string.find('*')
		for eu in range(rt, rt + c):
			if string[eu] == '.':
				e = 1
	elif c > 2 and a == 0:
		e = 1
	if m == 1 and i == k + 1 and (c == 0):
		e = 1
	if c == 2:
		e = 1
		break
	if a > 0:
		if c == 0:
			d += 1
	if d > 0:
		if c == 1:
			e = 1
if a > 0 and b == 1 and (e == 0):
	s = set(emon)
	le = len(s)
	if le == 1:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


(n, m) = map(int, input().split())
ss = [input() for i in range(n)]
s = [[1 if x == '*' else 0 for x in y] for y in ss]
dx = [0, 0, 0, -1, 1]
dy = [0, 1, -1, 0, 0]
ok = True
for i in range(1, n - 1):
	if not ok:
		break
	for j in range(1, m - 1):
		k = 0
		for q in range(5):
			if s[i + dx[q]][j + dy[q]] == 1:
				k += 1
		if k != 5:
			continue
		s[i][j] = 0
		for q in range(1, 5):
			ii = i
			jj = j
			while True:
				ii += dx[q]
				jj += dy[q]
				if not 0 <= ii < n or not 0 <= jj < m:
					break
				if s[ii][jj] == 1:
					s[ii][jj] = 0
				else:
					break
		ok = False
		break
any = False
for x in s:
	for y in x:
		if y == 1:
			any = True
print('NO' if any or ok else 'YES')


import math
import sys
(n, m) = map(int, input().split())
d = []
for i in range(n):
	d.append([i for i in input()])
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if d[i][j] == d[i + 1][j] == d[i - 1][j] == d[i][j - 1] == d[i][j + 1] == '*':
			d[i][j] = '.'
			for t in range(i + 1, n):
				if d[t][j] == '*':
					d[t][j] = '.'
				else:
					break
			for t in range(i - 1, -1, -1):
				if d[t][j] == '*':
					d[t][j] = '.'
				else:
					break
			for t in range(j + 1, m):
				if d[i][t] == '*':
					d[i][t] = '.'
				else:
					break
			for t in range(j - 1, -1, -1):
				if d[i][t] == '*':
					d[i][t] = '.'
				else:
					break
			for t in d:
				if '*' in t:
					exit(print('NO'))
			exit(print('YES'))
print('NO')


import sys
input = sys.stdin.readline

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

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

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

def li():
	return list(input().rstrip())
(h, w) = mi()
field = [[] for _ in range(h)]
for i in range(h):
	field[i] = li()
if h <= 2 or w <= 2:
	print('NO')
	sys.exit()
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
flag = False
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if field[i][j] == '*':
			for num in range(4):
				if field[i + dx[num]][j + dy[num]] == '*':
					continue
				else:
					break
			else:
				(centh, centw) = (i, j)
				flag = True
		else:
			continue
if not flag:
	print('NO')
else:
	field[centh][centw] = '.'
	for i in range(4):
		flag = True
		num = 1
		while flag:
			if centh + num * dx[i] < 0 or centh + num * dx[i] >= h or centw + num * dy[i] < 0 or (centw + num * dy[i] >= w) or (field[centh + num * dx[i]][centw + num * dy[i]] == '.'):
				flag = False
				break
			else:
				field[centh + num * dx[i]][centw + num * dy[i]] = '.'
				num += 1
	for i in range(h):
		if field[i] == ['.'] * w:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


import sys, math

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

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

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

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)

def print_list(l):
	print(' '.join(map(str, l)))
(h, w) = read_int_list()
grid = []
center = 0
counter = 0
total = 0
for i in range(h):
	grid.append(read_string())
for i in range(h):
	for j in range(w):
		if grid[i][j] == '*':
			total += 1
explored = set()
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if grid[i][j] == grid[i - 1][j] == grid[i + 1][j] == grid[i][j - 1] == grid[i][j + 1] == '*' and (i, j) not in explored:
			center += 1
			counter += 1
			for _i in range(i - 1, -1, -1):
				if grid[_i][j] == '*':
					counter += 1
					explored.add((_i, j))
				else:
					break
			for _i in range(i + 1, h):
				if grid[_i][j] == '*':
					counter += 1
					explored.add((_i, j))
				else:
					break
			for _j in range(j - 1, -1, -1):
				if grid[i][_j] == '*':
					counter += 1
					explored.add((i, _j))
				else:
					break
			for _j in range(j + 1, w):
				if grid[i][_j] == '*':
					counter += 1
					explored.add((i, _j))
				else:
					break
if center == 1 and counter == total:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(list(input()))
b = 0
for i in a:
	b += i.count('*')
x = y = -1
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if a[i][j] == a[i][j - 1] == a[i][j + 1] == a[i - 1][j] == a[i + 1][j] == '*':
			x = i
			y = j
			break
if x == y == -1:
	print('NO')
	return
r = 1
for i in range(x + 1, n):
	if a[i][y] == '*':
		r += 1
	else:
		break
for i in range(x - 1, -1, -1):
	if a[i][y] == '*':
		r += 1
	else:
		break
for i in range(y + 1, m):
	if a[x][i] == '*':
		r += 1
	else:
		break
for i in range(y - 1, -1, -1):
	if a[x][i] == '*':
		r += 1
	else:
		break
if r == b:
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
a = []
s = f = p = x = y = 0
for i in range(h):
	a.append(input())
	s += a[i].count('*')
for i in range(h):
	for j in range(w):
		if a[i][j] == '*':
			p = y = i
			x = j
			f = 2
			while a[p][j] == '*':
				s -= 1
				if p < h - 1:
					p += 1
				else:
					f = 1
					break
		if f:
			break
	if f:
		break
p -= f
f = 0
for i in range(y + 1, p + 1):
	for j in range(x):
		if a[i][j] == '*':
			p = j
			while a[i][p] == '*':
				f += 1
				if p < w - 1:
					p += 1
				else:
					break
		if f:
			break
	if f:
		break
if f > 2:
	s -= f
print('YES' if s == -1 else 'NO')


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	arr.append(input())
seen = set()

def get_first_star():
	(r, c) = (-1, -1)
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				seen.add((i, j))
				return (i, j)
	return (r, c)

def vertical_points(r, c):
	i = r + 1
	while i < n and arr[i][c] == '*':
		seen.add((i, c))
		i += 1
	return i

def find_horizontal(r, re, c):
	i = r + 1
	found = False
	while i < re - 1:
		if arr[i][c - 1] == '*' and arr[i][c + 1] == '*':
			found = True
			break
		i += 1
	if not found:
		return -1
	j = c - 1
	while j >= 0 and arr[i][j] == '*':
		seen.add((i, j))
		j -= 1
	j = c + 1
	while j < m and arr[i][j] == '*':
		seen.add((i, j))
		j += 1
	return 1

def find_answer():
	(r, c) = get_first_star()
	if c <= 0 or c >= m - 1:
		return -1
	re = vertical_points(r, c)
	res = find_horizontal(r, re, c)
	if res == -1:
		return -1
	for i in range(n):
		for j in range(m):
			if (i, j) not in seen and arr[i][j] == '*':
				return -1
	return 1
print('YES' if find_answer() == 1 else 'NO')


(n, m) = map(int, input().split())
a = [[0] * m for i in range(n)]
for i in range(n):
	a[i] = input()
x = -1
y = -1
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if a[i][j] == '*' and a[i - 1][j] == '*' and (a[i][j - 1] == '*') and (a[i + 1][j] == '*') and (a[i][j + 1] == '*'):
			x = j
			y = i
if x == -1 and y == -1:
	print('NO')
	quit()
for i in range(x, m):
	if a[y][i] == '.':
		break
	a[y] = a[y][:i] + '.' + a[y][i + 1:]
a[y] = a[y][:x] + '*' + a[y][x + 1:]
for i in range(x, -1, -1):
	if a[y][i] == '.':
		break
	a[y] = a[y][:i] + '.' + a[y][i + 1:]
a[y] = a[y][:x] + '*' + a[y][x + 1:]
for i in range(y, n):
	if a[i][x] == '.':
		break
	a[i] = a[i][:x] + '.' + a[i][x + 1:]
a[y] = a[y][:x] + '*' + a[y][x + 1:]
for i in range(y, -1, -1):
	if a[i][x] == '.':
		break
	a[i] = a[i][:x] + '.' + a[i][x + 1:]
for i in range(n):
	for j in range(m):
		if a[i][j] == '*':
			print('NO')
			quit()
print('YES')


def check(pic, row, col, h, w):
	for i in range(row + 1, h):
		for j in range(w):
			if j != col:
				if pic[i][j] == '*':
					return False
	for i in range(row - 1, -1, -1):
		for j in range(w):
			if j != col:
				if pic[i][j] == '*':
					return False
	col1 = col
	while col < w:
		if pic[row][col] == '*':
			col += 1
		else:
			break
	for i in range(col, w):
		if pic[row][i] == '*':
			return False
	col = col1
	while col > -1:
		if pic[row][col] == '*':
			col -= 1
		else:
			break
	for i in range(col, -1, -1):
		if pic[row][i] == '*':
			return False
	row1 = row
	col = col1
	while row < h:
		if pic[row][col] == '*':
			row += 1
		else:
			break
	for i in range(row, h):
		if pic[i][col] == '*':
			return False
	row = row1
	while row > -1:
		if pic[row][col] == '*':
			row -= 1
		else:
			break
	for i in range(row, -1, -1):
		if pic[i][col] == '*':
			return False
	return True

def main():
	(h, w) = map(int, input().split())
	pic = []
	for i in range(h):
		pic.append(input())
	for row in range(1, h - 1):
		for col in range(1, w - 1):
			if pic[row][col] == '*' and pic[row][col + 1] == '*' and (pic[row + 1][col] == '*') and (pic[row][col - 1] == '*') and (pic[row - 1][col] == '*'):
				if check(pic, row, col, h, w):
					print('YES')
					return
	print('NO')
main()


(n, m) = map(int, input().split())
s = list(([0] * m for _ in range(n)))
for i in range(n):
	s[i] = list(input())

def solve():
	(row_idx, col_idx) = (-1, -1)
	for i in range(1, n - 1):
		for j in range(1, m - 1):
			if s[i][j] == '*' and s[i - 1][j] == '*' and (s[i + 1][j] == '*') and (s[i][j - 1] == '*') and (s[i][j + 1] == '*'):
				row_idx = i
				col_idx = j
	if row_idx == -1 or col_idx == -1:
		return 'NO'
	(i, j, k) = (row_idx + 1, col_idx, 0)
	while i < n and s[i][j] == '*':
		s[i][j] = '.'
		i += 1
		k += 1
	if k == 0:
		return 'NO'
	(i, j, k) = (row_idx - 1, col_idx, 0)
	while i >= 0 and s[i][j] == '*':
		s[i][j] = '.'
		i -= 1
		k += 1
	if k == 0:
		return 'NO'
	(i, j, k) = (row_idx, col_idx + 1, 0)
	while j < m and s[i][j] == '*':
		s[i][j] = '.'
		j += 1
		k += 1
	if k == 0:
		return 'NO'
	(i, j, k) = (row_idx, col_idx - 1, 0)
	while j >= 0 and s[i][j] == '*':
		s[i][j] = '.'
		j -= 1
		k += 1
	if k == 0:
		return 'NO'
	s[row_idx][col_idx] = '.'
	for i in range(n):
		for j in range(m):
			if s[i][j] == '*':
				return 'NO'
	return 'YES'
print(solve())


(r, c) = map(int, input().split())
grid = []
for i in range(r):
	grid.append(list(input()))
ans = 'NO'
visited = [[0 for _ in range(c)] for _ in range(r)]
f = 0
for i in range(r):
	for j in range(c):
		if grid[i][j] == '*':
			row = i
			(horx, hory) = (-1, -1)
			found = False
			while row < r and grid[row][j] == '*':
				if not found and j - 1 >= 0 and (j + 1 < c) and (grid[row][j - 1] == '*') and (grid[row][j + 1] == '*'):
					horx = row
					hory = j
					found = True
				visited[row][j] = 1
				row += 1
			row -= 1
			if j - 1 >= 0 and grid[row][j - 1] == '*':
				f = 1
				break
			if found:
				x = horx
				y = hory
				while y >= 0 and grid[x][y] == '*':
					visited[x][y] = 1
					y -= 1
				y = hory
				while y < c and grid[x][y] == '*':
					visited[x][y] = 1
					y += 1
				f = 0
				for x in range(r):
					for y in range(c):
						if grid[x][y] == '*' and visited[x][y] == 0:
							f = 1
							break
					if f == 1:
						break
				if f == 0:
					ans = 'YES'
					f = 1
			f = 1
			break
	if f == 1:
		break
print(ans)


(h, w) = map(int, input().split())
l1 = []
c = 0
p = 0
for i in range(h):
	l1.append(list(input()))
	c += l1[i].count('*')
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if l1[i][j] == l1[i + 1][j] == l1[i - 1][j] == l1[i][j + 1] == l1[i][j - 1] == '*':
			q = i + 1
			r = i - 1
			s = j + 1
			t = j - 1
			p = 1
			while q < h and l1[q][j] == '*':
				p += 1
				q += 1
			while r >= 0 and l1[r][j] == '*':
				p += 1
				r -= 1
			while s < w and l1[i][s] == '*':
				p += 1
				s += 1
			while t >= 0 and l1[i][t] == '*':
				p += 1
				t -= 1
			break
	if p:
		break
print('YES' if c == p != 0 else 'NO')


(h, w) = map(int, input().strip().split())
v_col = []
h_row = []
bigrow = []
answer = True
for i in range(h):
	line = input()
	stars = line.count('*')
	if stars == 1:
		x = line.index('*')
		if v_col:
			if x != v_col[-1][0]:
				answer = False
		v_col.append((x, i))
	elif stars > 1:
		if '*.*' in line:
			answer = False
		firstx = line.index('*')
		bigrow.append([i, firstx, w - line[::-1].index('*') - 1])
		if not v_col:
			answer = False
		else:
			starcolumn = v_col[-1][0]
			if line[starcolumn] == '*':
				v_col.append((starcolumn, i))
if answer and len(bigrow) == 1:
	if bigrow[0][1] < v_col[0][0] < bigrow[0][2]:
		if [i[1] for i in v_col] == list(range(v_col[0][1], v_col[-1][1] + 1)):
			if v_col[0][1] < bigrow[0][0] < v_col[-1][1]:
				print('YES')
				exit()
print('NO')


(h, w) = map(int, input().split())
mat = []
for i in range(h):
	mat.append(list(input()))
flag = False
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if mat[i][j] == '*':
			if mat[i - 1][j] == '*' and mat[i + 1][j] == '*' and (mat[i][j - 1] == '*') and (mat[i][j + 1] == '*'):
				flag = True
				mat[i][j] = '.'
				row = i - 1
				while row >= 0 and mat[row][j] == '*':
					mat[row][j] = '.'
					row -= 1
				row = i + 1
				while row < h and mat[row][j] == '*':
					mat[row][j] = '.'
					row += 1
				col = j - 1
				while col >= 0 and mat[i][col] == '*':
					mat[i][col] = '.'
					col -= 1
				col = j + 1
				while col < w and mat[i][col] == '*':
					mat[i][col] = '.'
					col += 1
				break
	if flag:
		break
if not flag:
	print('NO')
else:
	for i in range(h):
		for j in range(w):
			if mat[i][j] == '*':
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')


import sys
(h, w) = map(int, input().split())
x = -1
y1 = -1
hor_beg = -1
hor_end = -1
vert_beg = -1
vert_end = -1
space_y = 0
space_x = 0
for i in range(h):
	m = input()
	for j in range(w):
		if m[j] == '*':
			if x == -1:
				x = j
				vert_beg = i
			elif j != x and y1 == -1:
				y1 = i
				hor_beg == j
				if y1 == vert_beg:
					print('NO')
					sys.exit()
			elif j != x and i == y1:
				if space_x == 1:
					print('NO')
					sys.exit()
				hor_end = j
			elif j != x:
				print('NO')
				sys.exit()
			elif j == x and space_y == 1:
				print('NO')
				sys.exit()
			vert_end = i
		elif m[j] == '.':
			if x != -1 and j == x:
				space_y = 1
			elif i == y1 and y1 != -1:
				space_x = 1
if y1 != -1 and hor_end > x and (vert_end > y1):
	print('YES')
else:
	print('NO')


from collections import deque
import sys
(n, m) = map(int, input().split())
picture = []
for _ in range(n):
	picture.append(list(input()))
existence = False
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if picture[i][j] == '*':
			if picture[i][j] == picture[i - 1][j] == picture[i + 1][j] == picture[i][j + 1] == picture[i][j - 1]:
				existence = True
				picture[i][j] = '.'
				l = i - 1
				r = i + 1
				u = j - 1
				d = j + 1
				while l >= 0 and picture[l][j] == '*':
					picture[l][j] = '.'
					l -= 1
				while r <= n - 1 and picture[r][j] == '*':
					picture[r][j] = '.'
					r += 1
				while u >= 0 and picture[i][u] == '*':
					picture[i][u] = '.'
					u -= 1
				while d <= m - 1 and picture[i][d] == '*':
					picture[i][d] = '.'
					d += 1
				for k in picture:
					if '*' in k:
						print('NO')
						sys.exit()
				print('YES')
				sys.exit()
print('NO')


(h, w) = input().split()
h = int(h)
w = int(w)
arr = []
for i in range(h):
	arr.append(input())
total = 0
for y in range(h):
	for x in range(w):
		total += 1 if arr[y][x] == '*' else 0
total += 4
xd = False
for sx in range(1, w - 1):
	for sy in range(1, h - 1):
		curr = 1
		if arr[sy][sx] != '*' or arr[sy][sx + 1] != '*' or arr[sy][sx - 1] != '*' or (arr[sy + 1][sx] != '*') or (arr[sy - 1][sx] != '*'):
			continue
		(x, y) = (sx, sy)
		while x >= 0:
			if arr[y][x] == '*':
				curr += 1
			else:
				break
			x -= 1
		(x, y) = (sx, sy)
		while y >= 0:
			if arr[y][x] == '*':
				curr += 1
			else:
				break
			y -= 1
		(x, y) = (sx, sy)
		while x < w:
			if arr[y][x] == '*':
				curr += 1
			else:
				break
			x += 1
		(x, y) = (sx, sy)
		while y < h:
			if arr[y][x] == '*':
				curr += 1
			else:
				break
			y += 1
		if not xd and curr == total:
			print('YES')
			exit()
		else:
			print('NO')
			exit()
if not xd:
	print('NO')


a = input()
h = int(a.split()[0])
w = int(a.split()[1])
c = 1
p = 0
m = 0
s = ''
b = 0
for i in range(h):
	s = s + input() + ' '
for r in s.split():
	m = m + 1
	if c == 1:
		if r.count('*') > 1:
			print('NO')
			p = 1
			break
		elif r.count('*') == 1:
			for j in range(w):
				if r[j] == '*':
					b = j
					c = 2
					continue
	elif c == 2:
		if r.count('*') == 1:
			if r[b] == '*':
				continue
			else:
				print('NO')
				p = 1
				break
		elif r.count('*') < 1:
			print('NO')
			p = 1
			break
		elif r.count('*') >= 3:
			if r[b] == '*' and r[b - 1] == '*' and (r[b + 1] == '*'):
				if '*' * r.count('*') in r:
					c = 3
					continue
		else:
			print('NO')
			p = 1
			break
	elif c == 3:
		if r.count('*') == 1:
			if r[b] == '*':
				c = 4
				continue
			else:
				print('NO')
				p = 1
				break
		else:
			print('NO')
			p = 1
			break
	elif c == 4:
		if r.count('*') == 1:
			if r[b] == '*':
				continue
			else:
				print('NO')
				p = 1
				break
		elif r.count('*') == 0:
			c = 5
			continue
		else:
			print('NO')
			p = 1
			break
	elif c == 5:
		if r.count('*') == 0:
			continue
		else:
			print('NO')
			p = 1
			break
if p == 0:
	if m == h:
		if c == 5 or c == 4:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


(H, W) = map(int, input().split())
board = []
for i in range(0, H):
	board.append(input())
partofplus = []
for i in range(0, H):
	lst = []
	for j in range(0, W):
		lst.append(False)
	partofplus.append(lst)
for i in range(1, H - 1):
	for j in range(1, W - 1):
		if board[i][j] == '*':
			if board[i - 1][j] == '*' and board[i][j - 1] == '*' and (board[i + 1][j] == '*') and (board[i][j + 1] == '*'):
				partofplus[i][j] = True
				index = i - 1
				while index >= 0:
					if board[index][j] == '*':
						partofplus[index][j] = True
					else:
						break
					index -= 1
				index = i + 1
				while index < H:
					if board[index][j] == '*':
						partofplus[index][j] = True
					else:
						break
					index += 1
				index = j - 1
				while index >= 0:
					if board[i][index] == '*':
						partofplus[i][index] = True
					else:
						break
					index -= 1
				index = j + 1
				while index < W:
					if board[i][index] == '*':
						partofplus[i][index] = True
					else:
						break
					index += 1
				break
	if partofplus[i][j]:
		break
ans = 'YES'
flag = True
for i in range(0, H):
	for j in range(0, W):
		if board[i][j] == '*':
			flag = False
			if not partofplus[i][j]:
				ans = 'NO'
				break
	if ans == 'NO':
		break
if flag:
	ans = 'NO'
print(ans)


(h, w) = list(map(int, input().split()))
a = [list(input().rstrip()) for _ in range(h)]
if h != 2 and w != 2:
	for ir in range(1, h - 1):
		for ic in range(1, w - 1):
			s = [[a[ir - 1][i] for i in range(ic - 1, ic + 2)]]
			s.append([a[ir][i] for i in range(ic - 1, ic + 2)])
			s.append([a[ir + 1][i] for i in range(ic - 1, ic + 2)])
			if s[0].count('*') == 1 and s[0][1] == '*':
				if s[1].count('*') == 3:
					if s[2].count('*') == 1 and s[2][1] == '*':
						(l, r) = (ic, ic)
						while l > 0 and a[ir][l - 1] == '*':
							l -= 1
						while r < len(a[ir]) - 1 and a[ir][r + 1] == '*':
							r += 1
						del a[ir][l:r + 1]
						(t, b) = (ir, ir)
						while t > 0 and a[t - 1][ic] == '*':
							t -= 1
						while b < h - 1 and a[b + 1][ic] == '*':
							b += 1
						for r in list(range(t, ir)) + list(range(ir + 1, b + 1)):
							del a[r][ic]
						for r in a:
							if '*' in r:
								print('NO')
								quit(0)
								break
						print('YES')
						quit(0)
print('NO')


(h, w) = map(int, input().split())
a = [list(input()) for i in range(h)]
center_i = -1
center_j = -1
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if a[i][j] == '*' and a[i - 1][j] == '*' and (a[i + 1][j] == '*') and (a[i][j + 1] == '*') and (a[i][j - 1] == '*'):
			center_i = i
			center_j = j
			break
	if center_j != -1:
		break
if center_j == -1:
	print('NO')
else:
	i = center_i
	j = center_j
	count = 0
	while a[i][j] == '*' or a[i][j] == '+':
		a[i][j] = '+'
		i += 1
		count += 1
		if i == h:
			break
	i = center_i
	j = center_j
	while a[i][j] == '*' or a[i][j] == '+':
		a[i][j] = '+'
		i -= 1
		count += 1
		if i == -1:
			break
	i = center_i
	j = center_j
	while a[i][j] == '*' or a[i][j] == '+':
		a[i][j] = '+'
		j += 1
		count += 1
		if j == w:
			break
	i = center_i
	j = center_j
	while a[i][j] == '*' or a[i][j] == '+':
		a[i][j] = '+'
		j -= 1
		count += 1
		if j == -1:
			break
	left_stars = 0
	for q in range(h):
		for e in range(w):
			if a[q][e] == '*':
				left_stars += 1
	if left_stars > 0:
		print('NO')
	else:
		print('YES')


(h, w) = map(int, input().split())
s = [list(input()) for i in range(h)]
hh = -1
tmp = -1
for (k, i) in enumerate(s):
	a = i.count('*')
	if tmp < a:
		tmp = a
		hh = k
t = [list(i) for i in list(zip(*s))]
ww = -1
tmp = -1
for (k, i) in enumerate(t):
	a = i.count('*')
	if tmp < a:
		tmp = a
		ww = k
if s[hh][ww] != '*':
	print('NO')
	return
if hh in (0, h - 1) or ww in (0, w - 1):
	print('NO')
	return
if '.' in (s[hh - 1][ww], s[hh + 1][ww], s[hh][ww - 1], s[hh][ww + 1]):
	print('NO')
	return
cnt = 1
for i in range(hh - 1, -1, -1):
	if s[i][ww] == '.':
		break
	cnt += 1
for i in range(ww - 1, -1, -1):
	if s[hh][i] == '.':
		break
	cnt += 1
for i in range(hh + 1, h):
	if s[i][ww] == '.':
		break
	cnt += 1
for i in range(ww + 1, w):
	if s[hh][i] == '.':
		break
	cnt += 1
for i in range(h):
	for j in range(w):
		cnt -= s[i][j] == '*'
if cnt != 0:
	print('NO')
else:
	print('YES')


(h, w) = map(int, input().split())
s = []
for _ in range(h):
	s.append(list(input()))
(rr, cc) = (None, None)
for r in range(1, h - 1):
	for c in range(1, w - 1):
		if s[r][c] == s[r - 1][c] == s[r][c - 1] == s[r + 1][c] == s[r][c + 1] == '*':
			s[r][c] = '.'
			i = r + 1
			while i < h and s[i][c] == '*':
				s[i][c] = '.'
				i += 1
			i = r - 1
			while i >= 0 and s[i][c] == '*':
				s[i][c] = '.'
				i -= 1
			i = c + 1
			while i < w and s[r][i] == '*':
				s[r][i] = '.'
				i += 1
			i = c - 1
			while i >= 0 and s[r][i] == '*':
				s[r][i] = '.'
				i -= 1
			for i in range(h):
				for j in range(w):
					if s[i][j] == '*':
						print('NO')
						exit(0)
			print('YES')
			exit(0)
print('NO')


(n, m) = tuple(map(int, input().rstrip().split()))
a = []
for i in range(0, n):
	row = list(input())
	a.append(row)

def cross(a):
	cross_found = False
	for i in range(0, n):
		for j in range(0, m):
			if a[i][j] == '.':
				pass
			elif 0 < i < n - 1 and 0 < j < m - 1 and (a[i][j] == '*') and (a[i - 1][j] == '*') and (a[i + 1][j] == '*') and (a[i][j - 1] == '*') and (a[i][j + 1] == '*'):
				if cross_found:
					return 'NO'
				cross_found = True
				k = j
				while 0 <= k < m and a[i][k] == '*':
					a[i][k] = 'X'
					k += 1
				k = j - 1
				while 0 <= k < m and a[i][k] == '*':
					a[i][k] = 'X'
					k -= 1
				k = i + 1
				while 0 <= k < n and a[k][j] == '*':
					a[k][j] = 'X'
					k += 1
				k = i - 1
				while 0 <= k < n and a[k][j] == '*':
					a[k][j] = 'X'
					k -= 1
			else:
				pass
	for i in range(0, n):
		for j in range(0, m):
			if a[i][j] == '*':
				return 'NO'
	if cross_found:
		return 'YES'
	else:
		return 'NO'
print(cross(a))


[m, n] = list(map(int, input().split()))
mat = []
for i in range(m):
	temp = list(input())
	mat.append(temp)
visited = {}
ans = 'NO'
for i in range(1, m - 1):
	flag = 0
	for j in range(1, n - 1):
		if mat[i][j] == '*' and mat[i + 1][j] == '*' and (mat[i][j + 1] == '*') and (mat[i - 1][j] == '*') and (mat[i][j - 1] == '*'):
			mat[i][j] = '.'
			vertical = i + 1
			while vertical < m and mat[vertical][j] == '*':
				mat[vertical][j] = '.'
				vertical += 1
			verticalR = i - 1
			while verticalR >= 0 and mat[verticalR][j] == '*':
				mat[verticalR][j] = '.'
				verticalR -= 1
			horizontal = j + 1
			while horizontal < n and mat[i][horizontal] == '*':
				mat[i][horizontal] = '.'
				horizontal += 1
			horizontalR = j - 1
			while horizontalR >= 0 and mat[i][horizontalR] == '*':
				mat[i][horizontalR] = '.'
				horizontalR -= 1
			ans = 'YES'
			flag = 1
			break
	if flag == 1:
		break
for i in range(m):
	flag = 0
	for j in range(n):
		if mat[i][j] == '*':
			ans = 'NO'
			flag = 1
			break
	if flag == 1:
		break
print(ans)


(m, n) = list(map(int, input().split()))
t = [input() for i in range(m)]
c = 0
import sys
for i in range(m):
	if c == 1:
		break
	for j in range(n):
		if c == 1:
			break
		if t[i][j] == '*':
			p = [0] * 4
			p[0] = i < m - 1 and t[i + 1][j] == '*'
			p[1] = j > 0 and t[i][j - 1] == '*'
			p[2] = i > 0 and t[i - 1][j] == '*'
			p[3] = j < n - 1 and t[i][j + 1] == '*'
			if sum(p) == 4:
				c = 1
				r = i
				c = j
if c == 0:
	print('NO')
	sys.exit(0)
else:
	i = r
	j = c
	w = 1
	while True:
		if i < m - 1 and t[i + 1][j] == '*':
			i += 1
			w += 1
		else:
			break
	i = r
	j = c
	while True:
		if j > 0 and t[i][j - 1] == '*':
			j -= 1
			w += 1
		else:
			break
	i = r
	j = c
	while True:
		if i > 0 and t[i - 1][j] == '*':
			i -= 1
			w += 1
		else:
			break
	i = r
	j = c
	while True:
		if j < n - 1 and t[i][j + 1] == '*':
			j += 1
			w += 1
		else:
			break
	h = 0
	for i in range(m):
		for j in range(n):
			if t[i][j] == '*':
				h += 1
if h != w:
	print('NO')
	sys.exit(0)
print('YES')


(n, m) = map(int, input().split())
lis = [[0] * m for i in range(n)]
c = 0
k = []
for i in range(n):
	a = input()
	for j in range(m):
		lis[i][j] = a[j]
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if lis[i][j] == '*':
			if lis[i - 1][j] == '*' and lis[i + 1][j] == '*' and (lis[i][j - 1] == '*') and (lis[i][j + 1] == '*'):
				c = 1
				a = i
				b = j
				while a < n and lis[a][b] == '*':
					k.append([a, b])
					a += 1
				a = i
				b = j
				while a >= 0 and lis[a][b] == '*':
					k.append([a, b])
					a -= 1
				a = i
				b = j
				while b < m and lis[a][b] == '*':
					k.append([a, b])
					b += 1
				a = i
				b = j
				while b >= 0 and lis[a][b] == '*':
					k.append([a, b])
					b -= 1
				break
	if c == 1:
		break
if c != 1:
	print('NO')
	exit()
for i in range(n):
	for j in range(m):
		if lis[i][j] == '*':
			if [i, j] not in k:
				print('NO')
				exit()
print('YES')


grid = []
(r, c) = [int(x) for x in input().split()]
for _ in range(r):
	a = input()
	grid.append(a)
vis = []
for i in range(r):
	a = []
	for j in range(c):
		a.append(False)
	vis.append(a)
fou = False
for i in range(1, r - 1):
	for j in range(1, c - 1):
		if grid[i][j] == '*' and grid[i - 1][j] == '*' and (grid[i][j + 1] == '*') and (grid[i + 1][j] == '*') and (grid[i][j - 1] == '*'):
			vis[i][j] = True
			vis[i - 1][j] = True
			vis[i + 1][j] = True
			vis[i][j - 1] = True
			vis[i][j + 1] = True
			fou = True
			break
	if fou == True:
		break
if fou == False:
	print('NO')
	quit()
a = i
b = j
q = a - 2
while q >= 0 and grid[q][b] == '*':
	vis[q][b] = True
	q -= 1
q = a + 2
while q < r and grid[q][b] == '*':
	vis[q][b] = True
	q += 1
q = b + 2
while q < c and grid[a][q] == '*':
	vis[a][q] = True
	q += 1
q = b - 2
while q >= 0 and grid[a][q] == '*':
	vis[a][q] = True
	q -= 1
for i in range(r):
	for j in range(c):
		if grid[i][j] == '*' and vis[i][j] == False:
			print('NO')
			quit()
print('YES')


(n, m) = map(int, input().split())
g = []
for i in range(n):
	g.append([])
star = 0
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
for i in range(n):
	g[i] = str(input())
	for each in g[i]:
		if each == '*':
			star += 1
queue = []
front = 0
back = 0
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if g[i][j] == '*':
			if g[i][j - 1] == '*' and g[i][j + 1] == '*' and (g[i - 1][j] == '*') and (g[i + 1][j] == '*'):
				ans = 5
				for k in range(0, 4):
					queue.append((i + dx[k], j + dy[k], k))
					back += 1
				while front < back:
					From = queue[front]
					front += 1
					next_x = From[0] + dx[From[2]]
					next_y = From[1] + dy[From[2]]
					if next_x >= 0 and next_x < n and (next_y >= 0) and (next_y < m) and (g[next_x][next_y] == '*'):
						queue.append((next_x, next_y, From[2]))
						back += 1
						ans += 1
					if front == back:
						break
				if ans == star:
					print('YES')
				else:
					print('NO')
				exit(0)
print('NO')


(h, w) = map(int, input().split())
a = []
for _ in range(h):
	a.append(list(input()))
ans = True
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if a[i][j] == a[i - 1][j] == a[i + 1][j] == a[i][j - 1] == a[i][j + 1] == '*':
			t = i + 1
			while t < h and a[t][j] == '*':
				a[t][j] = '-'
				t += 1
			t = i - 1
			while t >= 0 and a[t][j] == '*':
				a[t][j] = '-'
				t -= 1
			t = j
			while t < w and a[i][t] == '*':
				a[i][t] = '-'
				t += 1
			t = j - 1
			while t >= 0 and a[i][t] == '*':
				a[i][t] = '-'
				t -= 1
			for t in range(h):
				if '*' in a[t]:
					print('NO')
					exit()
			print('YES')
			exit()
print('NO')


(h, w) = map(int, input().split())
picture = []
plus = [[False for _ in range(w)] for _ in range(h)]
for i in range(h):
	picture.append(list(input()))
found = False
done = False
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if picture[i][j] == '*' and picture[i - 1][j] == '*' and (picture[i + 1][j] == '*') and (picture[i][j - 1] == '*') and (picture[i][j + 1] == '*'):
			up_end = i
			down_end = i
			left_end = j
			right_end = j
			while up_end >= 0 and picture[up_end][j] == '*':
				plus[up_end][j] = True
				up_end -= 1
			while down_end < h and picture[down_end][j] == '*':
				plus[down_end][j] = True
				down_end += 1
			while left_end >= 0 and picture[i][left_end] == '*':
				plus[i][left_end] = True
				left_end -= 1
			while right_end < w and picture[i][right_end] == '*':
				plus[i][right_end] = True
				right_end += 1
			for k in range(h):
				for l in range(w):
					if plus[k][l] != (picture[k][l] == '*'):
						found = False
						done = True
						break
			if not done:
				found = True
				done = True
		if done:
			break
	if done:
		break
if found:
	print('YES')
else:
	print('NO')


l = input().split()
h = int(l[0])
w = int(l[1])
l = []
for i in range(h):
	s = input()
	l.append(s)
done = 0
s = l
hashi = dict()
poss = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if s[i][j] == '*' and s[i + 1][j] == '*' and (s[i - 1][j] == '*') and (s[i][j - 1] == '*') and (s[i][j + 1] == '*'):
			done = 1
			ans = (i, j)
			hashi[i, j] = 1
		else:
			continue
		for k in range(j - 1, -1, -1):
			if s[i][k] == '*':
				hashi[i, k] = 1
			else:
				break
		for k in range(j + 1, w):
			if s[i][k] == '*':
				hashi[i, k] = 1
			else:
				break
		for k in range(i - 1, -1, -1):
			if s[k][j] == '*':
				hashi[k, j] = 1
			else:
				break
		for k in range(i + 1, h):
			if s[k][j] == '*':
				hashi[k, j] = 1
			else:
				break
		break
	if done:
		break
if done == 0:
	print('NO')
	quit()
poss = 1
for i in range(h):
	for j in range(w):
		if s[i][j] == '*' and (i, j) not in hashi:
			poss = 0
			break
if poss:
	print('YES')
else:
	print('NO')


import sys

class BPlusFromPicture:

	def solve(self):
		(h, w) = [int(_) for _ in input().split()]
		g = []
		for i in range(h):
			g.append([1 if item == '*' else 0 for item in list(input())])
		if h < 3 or w < 3:
			print('NO')
			return
		cnt = 0
		pos = (-1, -1)
		for i in range(1, h - 1):
			for j in range(1, w - 1):
				if g[i][j] and g[i][j + 1] and g[i + 1][j] and g[i][j - 1] and g[i - 1][j]:
					cnt += 1
					pos = (i, j)
		if cnt != 1:
			print('NO')
		else:
			(i, j) = pos
			while j < w and g[i][j]:
				j += 1
			r = j - 1
			(i, j) = pos
			while j >= 0 and g[i][j]:
				j -= 1
			l = j + 1
			(i, j) = pos
			while i >= 0 and g[i][j]:
				i -= 1
			t = i + 1
			(i, j) = pos
			while i < h and g[i][j]:
				i += 1
			b = i - 1
			ok = True
			for i in range(h):
				for j in range(w):
					if not g[i][j] or (t <= i <= b and j == pos[1]) or (l <= j <= r and i == pos[0]):
						continue
					ok = False
			print('YES' if ok else 'NO')
solver = BPlusFromPicture()
input = sys.stdin.readline
solver.solve()


import sys
R = lambda : map(int, input().split())
(h, w) = R()
m = []
new = [[0 for i in range(w)] for i in range(h)]
for _ in range(h):
	m.append(input())
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if m[i][j] == '*' and m[i][j - 1] == '*' and (m[i][j + 1] == '*') and (m[i - 1][j] == '*') and (m[i + 1][j] == '*'):
			up = i
			down = i
			left = j
			right = j
			while up >= 0 and m[up][j] == '*':
				new[up][j] = 1
				up -= 1
			while down < h and m[down][j] == '*':
				new[down][j] = 1
				down += 1
			while left >= 0 and m[i][left] == '*':
				new[i][left] = 1
				left -= 1
			while right < w and m[i][right] == '*':
				new[i][right] = 1
				right += 1
			for p in range(h):
				for q in range(w):
					if new[p][q] != (m[p][q] == '*'):
						print('NO')
						sys.exit()
			print('YES')
			sys.exit()
print('NO')


(h, w) = map(int, input().split())
v = -1
res = 'YES'
firstRow = h
for row in range(h):
	s = input()
	column = -1
	for i in range(w):
		if s[i] == '*':
			if i == 0 or i == w - 1:
				res = 'NO'
			if column > -1:
				res = 'NO'
			column = i
	if column > -1:
		firstRow = row
		break
if firstRow == h:
	res = 'NO'
tochki = '.' * w
end = False
wasCenter = False
wasAfterCenter = False
for i in range(firstRow + 1, h):
	s = input()
	if s[column] == '.' and (not end):
		end = True
	if end and s != tochki:
		res = 'NO'
	if res != 'YES':
		continue
	firstZ = -1
	lastZ = -1
	for j in range(w):
		if s[j] == '*':
			lastZ = j
		if s[j] == '*' and firstZ == -1:
			firstZ = j
	if end and lastZ > -1:
		res = 'NO'
		break
	if lastZ > firstZ:
		if s[firstZ:lastZ + 1] != '*' * (lastZ - firstZ + 1) or wasCenter or firstZ >= column or (lastZ <= column):
			res = 'NO'
		else:
			wasCenter = True
	if lastZ == firstZ and lastZ > -1 and wasCenter:
		wasAfterCenter = True
if not wasCenter:
	res = 'NO'
if not wasAfterCenter:
	res = 'NO'
print(res)


(w, h) = list(map(int, input().split()))
a = [list(input()) for _ in range(w)]
(l, t) = (0, 0)
for i in range(1, w - 1):
	for j in range(1, h - 1):
		if a[i][j] == '*' and a[i][j - 1] == '*' and (a[i][j + 1] == '*') and (a[i - 1][j] == '*') and (a[i + 1][j] == '*'):
			t = t + 1
			k = j - 1
			while k >= 0 and a[i][k] == '*':
				a[i][k] = '.'
				k = k - 1
			k = j + 1
			while k < h and a[i][k] == '*':
				a[i][k] = '.'
				k = k + 1
			k = i - 1
			while k >= 0 and a[k][j] == '*':
				a[k][j] = '.'
				k = k - 1
			k = i + 1
			while k < w and a[k][j] == '*':
				a[k][j] = '.'
				k = k + 1
			a[i][j] = '.'
			break
	if t == 1:
		break
for i in range(w):
	if a[i].count('.') != h:
		print('NO')
		l = l + 1
		break
if l == 0 and t == 1:
	print('YES')
if l == 0 and t == 0:
	print('NO')


def check(x, y, dx, dy):
	c = 0
	globals()
	if x + dx < 0 or x + dx >= h:
		return -1
	if y + dy < 0 or y + dy >= w:
		return -1
	while a[x + dx][y + dy] == '*':
		c += 1
		x += dx
		y += dy
		if x + dx < 0 or x + dx >= h:
			break
		if y + dy < 0 or y + dy >= w:
			break
	return c if c else -1
(h, w) = map(int, input().split())
a = [input() for i in range(h)]
cnt = 0
for i in a:
	cnt += i.count('*')
if cnt >= h + w:
	print('NO')
	exit()
else:
	for i in range(h):
		for j in range(w):
			if a[i][j] == '.':
				continue
			t = check(i, j, -1, 0)
			t += check(i, j, 0, -1)
			t += check(i, j, 0, 1)
			t += check(i, j, 1, 0)
			if t == cnt - 1:
				print('YES')
				exit()
print('NO')


(h, w) = map(int, input().split(' '))
matrix = [input() for _ in range(h)]
num_row = [sum((c == '*' for c in matrix[i])) for i in range(h)]
total = sum(num_row)
x = -1
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if matrix[i][j] == '*' and matrix[i - 1][j] == '*' and (matrix[i + 1][j] == '*') and (matrix[i][j - 1] == '*') and (matrix[i][j + 1] == '*'):
			x = i
			y = j
			break
if x == -1:
	print('NO')
	exit()
stars = 1
for k in range(y + 1, w):
	if matrix[x][k] == '*':
		stars += 1
	else:
		break
for k in range(y - 1, -1, -1):
	if matrix[x][k] == '*':
		stars += 1
	else:
		break
for k in range(x + 1, h):
	if matrix[k][y] == '*':
		stars += 1
	else:
		break
for k in range(x - 1, -1, -1):
	if matrix[k][y] == '*':
		stars += 1
	else:
		break
if total == stars:
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
if min(h, w) >= 3:
	g = [input() for i in 'a' * h]
	t = sum((sum((c == '*' for c in a)) for a in g))
	for i in range(1, h - 1):
		for j in range(1, w - 1):
			if g[i][j] + g[i][j - 1] + g[i][j + 1] + g[i - 1][j] + g[i + 1][j] == '*' * 5:
				(l, r) = (j, j)
				for y in range(w):
					if g[i][y] == '*':
						l = min(l, y)
						r = y
				(u, d) = (i, i)
				for x in range(h):
					if g[x][j] == '*':
						u = min(u, x)
						d = x
				print('YES' if ''.join((g[x][j] for x in range(u, d + 1))) + ''.join((g[i][y] for y in range(l, r + 1))) == '*' * (t + 1) else 'NO')
				exit(0)
print('NO')


(n, m) = [int(k) for k in input().split(' ')]
s = []
for k in range(n):
	s += [input() + 1000 * '.']
s += [500 * '.'] * 500
areok = set()
isdone = False
isok = True
for i in range(n):
	for j in range(m):
		if i > 0 and s[i][j] == '*' and (s[i - 1][j] == '*') and j and (s[i][j - 1] == '*'):
			areok.add((i, j))
			isdone = True
			for w in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
				howmuch = 1
				while s[i + w[0] * howmuch][j + w[1] * howmuch] == '*':
					areok.add((i + w[0] * howmuch, j + w[1] * howmuch))
					howmuch += 1
				if howmuch == 1:
					isok = False
			break
	if isdone:
		break
if not isdone:
	isok = False
if isok:
	for i in range(n):
		for j in range(m):
			if s[i][j] == '*' and (i, j) not in areok:
				isok = False
if isok:
	print('YES')
else:
	print('NO')


def main():
	buf = input()
	buflist = buf.split()
	h = int(buflist[0])
	w = int(buflist[1])
	S = []
	for i in range(h):
		buf = input()
		S.append(buf)
	cross_point = []
	for i in range(h):
		cross_point.append([])
		for j in range(w):
			if i > 0 and i < h - 1 and (j > 0) and (j < w - 1):
				if S[i][j] == '*' and S[i - 1][j] == '*' and (S[i + 1][j] == '*') and (S[i][j - 1] == '*') and (S[i][j + 1] == '*'):
					cross_point[i].append(True)
					continue
			cross_point[i].append(False)
	cross_point_location = None
	for i in range(h):
		for j in range(w):
			if cross_point[i][j]:
				if cross_point_location == None:
					cross_point_location = (i, j)
				else:
					print('NO')
					return
	if cross_point_location == None:
		print('NO')
		return
	group = []
	for i in range(h):
		group.append([])
		for j in range(w):
			group[i].append(False)
	for i in range(cross_point_location[0], h):
		if S[i][cross_point_location[1]] == '*':
			group[i][cross_point_location[1]] = True
		else:
			break
	for i in range(cross_point_location[0], -1, -1):
		if S[i][cross_point_location[1]] == '*':
			group[i][cross_point_location[1]] = True
		else:
			break
	for j in range(cross_point_location[1], w):
		if S[cross_point_location[0]][j] == '*':
			group[cross_point_location[0]][j] = True
		else:
			break
	for j in range(cross_point_location[1], -1, -1):
		if S[cross_point_location[0]][j] == '*':
			group[cross_point_location[0]][j] = True
		else:
			break
	for i in range(h):
		for j in range(w):
			if S[i][j] == '*' and (not group[i][j]):
				print('NO')
				return
	print('YES')
main()


(n, m) = list(map(int, input().split()))

def parc(pt, j):
	if l[pt[0]][pt[1]]:
		l[pt[0]][pt[1]] = False
		parc(j(pt), j)

def f():
	mv = [lambda x: (x[0] + 1, x[1]), lambda x: (x[0] - 1, x[1]), lambda x: (x[0], x[1] - 1), lambda x: (x[0], x[1] + 1)]
	for k in range(2, n):
		for i in range(2, m):
			if l[k][i] and min((l[j[0]][j[1]] for j in [h((k, i)) for h in mv])):
				for j in mv:
					parc(j((k, i)), j)
				l[k][i] = False
				if max(list(map(max, l))):
					return False
				return True
	return False
l = [[False] * (m + 2)]
for k in range(n):
	l.append([False] + [i == '*' for i in input()] + [False])
l.append([False] * (m + 2))
if f():
	print('YES')
else:
	print('NO')


from sys import stdin

def func():
	return
(h, w) = map(int, stdin.readline().split())
arr = []
for i in range(h):
	m = stdin.readline().strip()
	arr.append(m)
ans = []
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if arr[i][j] == '*':
			if arr[i][j + 1] == '*' and arr[i + 1][j] == '*' and (arr[i][j - 1] == '*') and (arr[i - 1][j] == '*'):
				ans.append([i, j])
if len(ans) != 1:
	print('NO')
else:
	i = ans[0][0]
	j = ans[0][1]
	while i < h and arr[i][j] == '*':
		i += 1
	rl = i - 1
	i = ans[0][0]
	while i >= 0 and arr[i][j] == '*':
		i -= 1
	rs = i + 1
	i = ans[0][0]
	while j < w and arr[i][j] == '*':
		j += 1
	cl = j - 1
	j = ans[0][1]
	while j >= 0 and arr[i][j] == '*':
		j -= 1
	cs = j + 1
	cond = True
	for i in range(h):
		for j in range(w):
			if i >= rs and i <= rl and (j == ans[0][1]) or (j >= cs and j <= cl and (i == ans[0][0])):
				pass
			elif arr[i][j] == '*':
				cond = False
				break
		if cond == False:
			break
	if cond == False:
		print('NO')
	else:
		print('YES')


centers = []
stars_in_common = 0
(H, W) = map(int, input().split())
TABLE = [['' for i in range(W)] for j in range(H)]
for i in range(H):
	TABLE[i] = list(input())

def find_center():
	global stars_in_common
	for i in range(H):
		for j in range(W):
			if TABLE[i][j] == '*':
				stars_in_common += 1
				if i == 0 or j == 0 or i + 1 == H or (j + 1 == W):
					continue
				if TABLE[i][j - 1] != '*' or TABLE[i + 1][j] != '*' or TABLE[i - 1][j] != '*' or (TABLE[i][j + 1] != '*'):
					continue
				centers.append({'x': j, 'y': i})

def count_stars():
	stars_in_cross = 1
	x = centers[0]['x'] - 1
	while TABLE[centers[0]['y']][x] == '*' and x >= 0 and (x < W):
		x -= 1
		stars_in_cross += 1
		if x < 0 or x == W:
			break
	x = centers[0]['x'] + 1
	while TABLE[centers[0]['y']][x] == '*' and x >= 0 and (x < W):
		x += 1
		stars_in_cross += 1
		if x < 0 or x == W:
			break
	y = centers[0]['y'] - 1
	while TABLE[y][centers[0]['x']] == '*' and y >= 0 and (y < H):
		y -= 1
		stars_in_cross += 1
		if y < 0 or y == H:
			break
	y = centers[0]['y'] + 1
	while TABLE[y][centers[0]['x']] == '*' and y >= 0 and (y < H):
		y += 1
		stars_in_cross += 1
		if y < 0 or y == H:
			break
	return stars_in_cross
find_center()
if len(centers) != 1:
	print('NO')
elif count_stars() != stars_in_common:
	print('NO')
else:
	print('YES')


def dfn():
	(h, w) = map(int, input().split())
	ar = []
	for _ in range(h):
		ar.append(input())
	picture = ar
	should_be_plus = [[0 for _ in range(w)] for _ in range(h)]
	for i in range(1, h - 1):
		for j in range(1, w - 1):
			if picture[i][j] == '*' and picture[i - 1][j] == '*' and (picture[i + 1][j] == '*') and (picture[i][j + 1] == '*') and (picture[i][j - 1] == '*'):
				(upend, downend, leftend, rightend) = (i, i, j, j)
				while upend >= 0 and picture[upend][j] == '*':
					should_be_plus[upend][j] = 1
					upend -= 1
				while downend < h and picture[downend][j] == '*':
					should_be_plus[downend][j] = 1
					downend += 1
				while leftend >= 0 and picture[i][leftend] == '*':
					should_be_plus[i][leftend] = 1
					leftend -= 1
				while rightend < w and picture[i][rightend] == '*':
					should_be_plus[i][rightend] = 1
					rightend += 1
				for i2 in range(h):
					for j2 in range(w):
						if should_be_plus[i2][j2] != (picture[i2][j2] == '*'):
							return 'NO\n'
				return 'YES\n'
	return 'NO\n'
print(dfn())


(H, W) = map(int, input().split())
PlusH = []
PlusW = []
for h in range(0, H):
	Wi = list(map(str, input()))
	for w in range(0, len(Wi)):
		if Wi[w] == '*':
			PlusH.append(h)
			PlusW.append(w)
Ans = False
Pt0 = True
Pt3 = False
if len(PlusH) > 4:
	for i in range(1, len(PlusH)):
		if Pt0:
			if PlusH[i - 1] == PlusH[i] - 1 and PlusW[i - 1] == PlusW[i]:
				continue
			elif PlusH[i - 1] == PlusH[i] - 1:
				Pt1 = True
				Pt0 = False
			else:
				break
		elif Pt1:
			if PlusH[i - 1] == PlusH[i] and PlusW[i - 1] == PlusW[i] - 1:
				if PlusW[i] == PlusW[0]:
					if i < len(PlusH) - 1:
						if PlusW[i + 1] == PlusW[0] + 1:
							if PlusH[i] == PlusH[i + 1]:
								Pt3 = True
			elif Pt3 and PlusH[i - 1] == PlusH[i] - 1 and (PlusW[i] == PlusW[0]):
				Pt1 = False
				Pt2 = True
				Ans = True
			else:
				break
		elif Pt2:
			if PlusH[i - 1] == PlusH[i] - 1 and PlusW[i - 1] == PlusW[i]:
				if i == len(PlusH) - 1:
					break
			else:
				Ans = False
				break
if Ans:
	print('YES')
else:
	print('NO')


def _is_safe(r, c, h, w):
	if r < 0 or r > h - 1 or c < 0 or (c > w - 1):
		return False
	return True

def check_fig(h, w, grid):
	found = False
	for r in range(h):
		for c in range(w):
			if grid[r][c] == '*':
				if found:
					return False
				elif _check_fig(r, c, h, w, grid):
					found = True
				else:
					return False
	return found

def _check_fig(r, c, h, w, grid):
	if c == 0 or c == w - 1:
		return False
	center = None
	while r < h - 1 and grid[r][c] == '*':
		if grid[r][c - 1] == '*' and grid[r][c + 1] == '*' and (grid[r + 1][c] == '*'):
			center = (r, c)
			break
		r += 1
	if not center:
		return False
	grid[center[0]][center[1]] = '+'
	if center[0] == 0 or center[0] == h - 1:
		return False
	(r, c) = center
	r -= 1
	if grid[r][c] != '*':
		return False
	while r >= 0 and grid[r][c] == '*':
		grid[r][c] = '+'
		if grid[r][c - 1] == '*' or grid[r][c + 1] == '*':
			return False
		r -= 1
	(r, c) = center
	r += 1
	if grid[r][c] != '*':
		return False
	while r < h and grid[r][c] == '*':
		grid[r][c] = '+'
		if grid[r][c - 1] == '*' or grid[r][c + 1] == '*':
			return False
		r += 1
	(r, c) = center
	c -= 1
	if grid[r][c] != '*':
		return False
	while c >= 0 and grid[r][c] == '*':
		grid[r][c] = '+'
		if grid[r + 1][c] == '*' or grid[r - 1][c] == '*':
			return False
		c -= 1
	(r, c) = center
	c += 1
	if grid[r][c] != '*':
		return False
	while c < w and grid[r][c] == '*':
		grid[r][c] = '+'
		if grid[r + 1][c] == '*' or grid[r - 1][c] == '*':
			return False
		c += 1
	return True
(h, w) = map(int, input().split(' '))
grid = []
for _ in range(h):
	grid.append(list(input()))
if check_fig(h, w, grid):
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline
(h, w) = [int(i) for i in input().split()]
l = []
for i in range(h):
	l.append(input())
if h < 3 or w < 3:
	print('NO')
	exit(0)
have = 0
for i in range(h):
	for j in range(w):
		if l[i][j] == '*':
			have += 1
(a, b) = (-1, -1)
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if l[i - 1][j] == l[i][j] == l[i][j + 1] == l[i][j - 1] == l[i][j + 1] == '*':
			(a, b) = (i, j)
			break
	else:
		continue
	break
if a == -1:
	print('NO')
	exit(0)
cnt = 1
(c, d) = (a, b)
k = 1
flag = [0, 0, 0, 0]
while c - k >= 0:
	if l[c - k][d] == '*':
		cnt += 1
		k += 1
		flag[0] = 1
	else:
		break
(c, d) = (a, b)
k = 1
while c + k < h:
	if l[c + k][d] == '*':
		cnt += 1
		k += 1
		flag[1] = 1
	else:
		break
(c, d) = (a, b)
k = 1
while d - k >= 0:
	if l[c][d - k] == '*':
		cnt += 1
		k += 1
		flag[2] = 1
	else:
		break
(c, d) = (a, b)
k = 1
while d + k < w:
	if l[c][d + k] == '*':
		cnt += 1
		k += 1
		flag[3] = 1
	else:
		break
if 0 in flag:
	print('NO')
	exit(0)
if cnt == have:
	print('YES')
else:
	print('NO')


(N, M) = map(int, input().split())
Matrix = []
for i in range(N):
	temp = input()
	temp2 = []
	for k in temp:
		temp2.append(k)
	Matrix.append(temp2)
count = 0
flag = 1
StarCount = 0
for i in range(N):
	for j in range(M):
		if Matrix[i][j] == '*':
			StarCount += 1
			if count == 1:
				flag = 0
				print('NO')
				break
			if i - 1 >= 0 and j - 1 >= 0 and (i + 1 < N) and (j + 1 < M) and (Matrix[i + 1][j] == '*') and (Matrix[i - 1][j] == '*') and (Matrix[i][j + 1] == '*') and (Matrix[i][j - 1] == '*'):
				j1 = j
				while j1 < M and Matrix[i][j1] == '*':
					Matrix[i][j1] = '.'
					j1 += 1
				j2 = j - 1
				while j2 >= 0 and Matrix[i][j2] == '*':
					Matrix[i][j2] = '.'
					j2 -= 1
				i1 = i + 1
				while i1 < N and Matrix[i1][j] == '*':
					Matrix[i1][j] = '.'
					i1 += 1
				i2 = i - 1
				while i2 >= 0 and Matrix[i2][j] == '*':
					Matrix[i2][j] = '.'
					i2 -= 1
				count += 1
	if flag == 0:
		break
if flag:
	if StarCount == 0:
		print('NO')
		exit()
	fla = 1
	for i in range(N):
		for j in range(M):
			if Matrix[i][j] == '*':
				print('NO')
				fla = 0
				break
		if fla == 0:
			break
	if fla:
		print('YES')


(n, m) = list(map(int, input().split()))
l = []
for _ in range(n):
	a = input()
	l.append(a)
f = 0
ind = ()
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if l[i][j] == '*':
			if l[i - 1][j] == '*' and l[i][j - 1] == '*' and (l[i + 1][j] == '*') and (l[i][j + 1] == '*'):
				if f == 0:
					f = 1
					ind = (i, j)
				else:
					f = 0
					break
if f == 1:
	top = (0, 0)
	bottom = (0, 0)
	left = (0, 0)
	right = (0, 0)
	for i in range(ind[0] - 1, -1, -1):
		if l[i][ind[1]] == '*':
			top = (i, ind[1])
		else:
			break
	for i in range(ind[0] + 1, n):
		if l[i][ind[1]] == '*':
			bottom = (i, ind[1])
		else:
			break
	for j in range(ind[1] - 1, -1, -1):
		if l[ind[0]][j] == '*':
			left = (ind[0], j)
		else:
			break
	for j in range(ind[1] + 1, m):
		if l[ind[0]][j] == '*':
			right = (ind[0], j)
		else:
			break
	for i in range(n):
		for j in range(m):
			if j == top[1] and i >= top[0] and (i <= bottom[0]):
				continue
			if i == left[0] and j >= left[1] and (j <= right[1]):
				continue
			if l[i][j] == '*':
				f = 0
				break
if f == 0:
	print('NO')
else:
	print('YES')


from sys import stdin

def solve():
	(h, w) = map(int, stdin.readline().split())
	P = []
	for _ in range(h):
		r = list(stdin.readline().strip())
		P.append(r)
	ans = 0
	used = set()
	check = set()
	for i in range(h):
		for j in range(w):
			if P[i][j] == '*':
				if (i, j) in used:
					continue
				if ans == 1:
					print('NO')
					return
				if i == 0 or i == h - 1 or j == 0 or (j == w - 1):
					check.add((i, j))
					continue
				if P[i - 1][j] != '*' or P[i + 1][j] != '*' or P[i][j + 1] != '*' or (P[i][j - 1] != '*'):
					check.add((i, j))
					continue
				ans = 1
				i_ = i + 1
				j_ = j + 1
				used.add((i, j))
				while i_ < h and P[i_][j] == '*':
					used.add((i_, j))
					i_ += 1
				i_ = i - 1
				while i_ >= 0 and P[i_][j] == '*':
					used.add((i_, j))
					i_ -= 1
				while j_ < w and P[i][j_] == '*':
					used.add((i, j_))
					j_ += 1
				j_ = j - 1
				while j_ >= 0 and P[i][j_] == '*':
					used.add((i, j_))
					j_ -= 1
				ans = 1
	if check:
		if not check.issubset(used):
			ans = 0
	print('YES' if ans else 'NO')
solve()


def naiveSolve():
	return

def main():
	(n, m) = readIntArr()
	grid = []
	for _ in range(n):
		grid.append(input())
	cI = -1
	cJ = -1
	ok = True
	for i in range(1, n - 1):
		for j in range(1, m - 1):
			if grid[i][j] == grid[i - 1][j] == grid[i][j - 1] == grid[i + 1][j] == grid[i][j + 1] == '*':
				if cI == -1:
					cI = i
					cJ = j
				else:
					ok = False
	if ok == False or cI == -1:
		print('NO')
		return
	minI = minJ = inf
	maxI = maxJ = -1
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '*':
				if i == cI:
					minJ = min(minJ, j)
					maxJ = max(maxJ, j)
				elif j == cJ:
					minI = min(minI, i)
					maxI = max(maxI, i)
				else:
					ok = False
	if ok == False:
		print('NO')
		return
	horizontalCnts = 0
	for j in range(m):
		if grid[cI][j] == '*':
			horizontalCnts += 1
	verticalCnts = 0
	for i in range(n):
		if grid[i][cJ] == '*':
			verticalCnts += 1
	if horizontalCnts < maxJ - minJ + 1 or verticalCnts < maxI - minI + 1:
		ok = False
	if ok:
		print('YES')
	else:
		print('NO')
	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(l, r):
	print('? {} {}'.format(l, r))
	sys.stdout.flush()
	return int(input())

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


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

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

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

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)
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')

def find_parent(parent, i, cnt):
	cnt += 1
	if parent[i - 1] == i:
		return cnt
	if parent[i - 1] != i:
		find_parent(parent, parent[i - 1], cnt)
(h, w) = map(int, input().split())
a = []
t = 0
for i in range(h):
	x = input()
	a.append(x)
	t += x.count('*')
c = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if a[i][j] == '*' and a[i + 1][j] == '*' and (a[i - 1][j] == '*') and (a[i][j + 1] == '*') and (a[i][j - 1] == '*'):
			c += 1
			for p in range(i + 1, h):
				if a[p][j] == '*':
					c += 1
				else:
					break
			for q in range(i - 1, -1, -1):
				if a[q][j] == '*':
					c += 1
				else:
					break
			for r in range(j + 1, w):
				if a[i][r] == '*':
					c += 1
				else:
					break
			for s in range(j - 1, -1, -1):
				if a[i][s] == '*':
					c += 1
				else:
					break
			if c == t:
				print('YES')
			else:
				print('NO')
			exit()
print('NO')


(h, w) = map(int, input().split())
s = [list(input()) for i in range(h)]
cnt = 0
p = 0
for i in range(h):
	cnt += s[i].count('*')
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if s[i][j] == s[i - 1][j] == s[i + 1][j] == s[i][j - 1] == s[i][j + 1] == '*':
			p += 1
			(l, r, u, d) = (j - 1, j + 1, i - 1, i + 1)
			while 0 <= l and s[i][l] == '*':
				l -= 1
				p += 1
			while r < w and s[i][r] == '*':
				r += 1
				p += 1
			while u >= 0 and s[u][j] == '*':
				u -= 1
				p += 1
			while d < h and s[d][j] == '*':
				d += 1
				p += 1
		if p > 0:
			break
	if p > 0:
		break
print('YES' if cnt == p != 0 else 'NO')


(h, w) = map(int, input().split())
a = []
t = 0
for i in range(h):
	x = input()
	a.append(x)
	t += x.count('*')
c = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if a[i][j] == '*' and a[i + 1][j] == '*' and (a[i - 1][j] == '*') and (a[i][j + 1] == '*') and (a[i][j - 1] == '*'):
			c += 1
			for p in range(i + 1, h):
				if a[p][j] == '*':
					c += 1
				else:
					break
			for q in range(i - 1, -1, -1):
				if a[q][j] == '*':
					c += 1
				else:
					break
			for r in range(j + 1, w):
				if a[i][r] == '*':
					c += 1
				else:
					break
			for s in range(j - 1, -1, -1):
				if a[i][s] == '*':
					c += 1
				else:
					break
			if c == t:
				print('YES')
			else:
				print('NO')
			exit()
print('NO')


from collections import defaultdict as dd
import math
import sys

def nn():
	return int(input())

def li():
	return list(input())

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

def lm():
	return list(map(int, input().split()))
(h, w) = mi()
picture = []
rowtotals = [0] * h
coltotals = [0] * w
total = 0
for i in range(h):
	picture.append(li())
for i in range(h):
	for j in range(w):
		if picture[i][j] == '*':
			rowtotals[i] += 1
			coltotals[j] += 1
			total += 1
col = -1
row = -1
for i in range(h):
	if rowtotals[i] > 1 and row == -1:
		row = i
for j in range(w):
	if coltotals[j] > 1 and col == -1:
		col = j
if col == -1 or row == -1:
	print('NO')
else:
	count = 1
	i = 1
	j = 1
	k = 1
	l = 1
	while row - i >= 0:
		if picture[row - i][col] == '*':
			count += 1
		else:
			break
		i += 1
	while row + k < h:
		if picture[row + k][col] == '*':
			count += 1
		else:
			break
		k += 1
	while col - j >= 0:
		if picture[row][col - j] == '*':
			count += 1
		else:
			break
		j += 1
	while col + l < w:
		if picture[row][col + l] == '*':
			count += 1
		else:
			break
		l += 1
	if i > 1 and j > 1 and (k > 1) and (l > 1) and (count == total):
		print('YES')
	else:
		print('NO')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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 value():
	return map(int, input().split())

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

def check(m, ind):
	if m[ind] != '*':
		return 0
	st = 0
	while st < len(m) and m[st] != '*':
		st += 1
	en = st
	while en < len(m) and m[en] == '*':
		en += 1
	for i in range(en + 1, len(m)):
		if m[i] == '*':
			return 0
	if ind > st and ind < en - 1:
		return 1
	return 0
for _ in range(1):
	(r, c) = value()
	m = []
	for i in range(r):
		m.append(list(input()))
	found = False
	flag = 0
	for i in range(r):
		c = m[i].count('*')
		if c == 0:
			continue
		if c > 1:
			flag = 0
			break
		else:
			flag = 1
			start_row = i
			ind = m[i].index('*')
			break
	if flag == 0:
		print('NO')
		continue
	for i in range(start_row, r):
		c = m[i].count('*')
		if c == 0:
			flag = 0
			break
		if c == 1 and m[i].index('*') != ind:
			flag = 0
			break
		elif c > 1:
			break
	mid_row = i
	if flag == 0:
		print('NO')
		continue
	i = mid_row + 1
	while i < r and m[i].count('*') == 1 and (m[i].index('*') == ind):
		i += 1
	for j in range(i, r):
		if m[j].count('*') > 0:
			flag = 0
			break
	if flag == 0 or i == mid_row + 1:
		print('NO')
		continue
	f = check(m[mid_row], ind)
	if f == 1:
		print('YES')
	else:
		print('NO')


(a, b) = map(int, input().split())
resp = True
grid = []
for i in range(a):
	grid.append(input())
if a < 3 or b < 3:
	resp = False
else:
	l = [0 for i in range(a)]
	c = [0 for i in range(b)]
	for i in range(a):
		for j in range(b):
			if grid[i][j] == '*':
				l[i] += 1
				c[j] += 1
	ml = -1
	mc = -1
	flag = 0
	for i in range(a):
		if l[i] == 0:
			if flag == 1:
				flag = 2
		elif flag == 2:
			resp = False
		elif l[i] != 1 and ml != -1:
			resp = False
		elif l[i] != 1:
			ml = i
			flag = 1
		else:
			flag = 1
	flag = 0
	for i in range(b):
		if c[i] == 0:
			if flag == 1:
				flag = 2
		elif flag == 2:
			resp = False
		elif c[i] != 1 and mc != -1:
			resp = False
		elif c[i] != 1:
			mc = i
			flag = 1
		else:
			flag = 1
	if grid[ml][mc] != '*':
		resp = False
	if ml == 0 or ml >= a - 1 or mc == 0 or (mc >= b - 1):
		resp = False
	elif grid[ml][mc + 1] != '*' or grid[ml][mc - 1] != '*' or grid[ml + 1][mc] != '*' or (grid[ml - 1][mc] != '*'):
		resp = False
if resp:
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
v = 0
k = 0
if h >= 3 and w >= 3:
	f = True
	table = []
	for i in range(h):
		a = list(input())
		table.append(a)
		v += a.count('*')
	for i in range(1, h - 1):
		if not f:
			break
		for j in range(1, w - 1):
			if not f:
				break
			if table[i][j] == '*':
				if table[i - 1][j] == table[i + 1][j] == table[i][j + 1] == table[i][j - 1] == '*':
					k += 1
					indexi = i - 1
					while True:
						if indexi == -1 or table[indexi][j] != '*':
							break
						if table[indexi][j] == '*':
							k += 1
						indexi -= 1
					indexi = i + 1
					while True:
						if indexi == h or table[indexi][j] != '*':
							break
						if table[indexi][j] == '*':
							k += 1
						indexi += 1
					indexj = j - 1
					while True:
						if indexj == -1 or table[i][indexj] != '*':
							break
						if table[i][indexj] == '*':
							k += 1
						indexj -= 1
					indexj = j + 1
					while True:
						if indexj == w or table[i][indexj] != '*':
							break
						if table[i][indexj] == '*':
							k += 1
						indexj += 1
					f = False
	if k == v != 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


(r, c) = map(int, input().split())
row = []
col = []
plus = []
pic = []
position = []
dic = set()
for i in range(r):
	pic.append(input())
for i in range(r):
	for j in range(c):
		if i > 0 and i < r - 1 and (j > 0) and (j < c - 1):
			if pic[i][j] == '*' and pic[i - 1][j] == '*' and (pic[i + 1][j] == '*') and (pic[i][j - 1] == '*') and (pic[i][j + 1] == '*'):
				plus.append([i, j])
			elif pic[i][j] == '*':
				position.append(str(i) + '-' + str(j))
		elif pic[i][j] == '*':
			position.append(str(i) + '-' + str(j))
if len(plus) != 1:
	print('NO')
else:
	(x, y) = plus[0]
	for i in range(y, c):
		if pic[x][i] == '*':
			dic.add(str(x) + '-' + str(i))
		else:
			break
	for i in range(y - 1, -1, -1):
		if pic[x][i] == '*':
			dic.add(str(x) + '-' + str(i))
		else:
			break
	for i in range(x, r):
		if pic[i][y] == '*':
			dic.add(str(i) + '-' + str(y))
		else:
			break
	for i in range(x - 1, -1, -1):
		if pic[i][y] == '*':
			dic.add(str(i) + '-' + str(y))
		else:
			break
	for v in position:
		if v not in dic:
			print('NO')
			exit()
	print('YES')


import sys
lines = sys.stdin.readlines()
[h, w] = lines[0].strip().split()
pic = lines[1:]

def multiCross(input, w, h):
	result = []
	starCount = 0
	for i in range(w):
		for j in range(h):
			if input[i][j] != '*':
				continue
			starCount += 1
			if i == 0 or i == w - 1 or j == 0 or (j == h - 1):
				continue
			if input[i - 1][j] == '*' and input[i + 1][j] == '*' and (input[i][j - 1] == '*') and (input[i][j + 1] == '*'):
				result.append([i, j])
	if len(result) != 1:
		return False
	i = result[0][0] - 1
	while i >= 0:
		if input[i][result[0][1]] != '*':
			break
		starCount -= 1
		i -= 1
	j = result[0][1] - 1
	while j >= 0:
		if input[result[0][0]][j] != '*':
			break
		starCount -= 1
		j -= 1
	i = result[0][0] + 1
	while i < w:
		if input[i][result[0][1]] != '*':
			break
		starCount -= 1
		i += 1
	j = result[0][1] + 1
	while j < h:
		if input[result[0][0]][j] != '*':
			break
		starCount -= 1
		j += 1
	return starCount == 1
if multiCross(pic, int(h), int(w)):
	print('YES')
else:
	print('NO')


def main():
	(h, w) = list(map(int, input().split()))
	matrix = [input() for j in range(h)]
	cnt = 0
	for i in range(h):
		for j in range(w):
			if matrix[i][j] == '*':
				cnt += 1
	if w < 3 or h < 3:
		print('NO')
	else:
		ok = False
		for y in range(1, h - 1):
			for x in range(1, w - 1):
				if matrix[y][x] == '*' and matrix[y + 1][x] == '*' and (matrix[y - 1][x] == '*') and (matrix[y][x + 1] == '*') and (matrix[y][x - 1] == '*'):
					r = ''
					c = ''
					for i in range(w):
						r += matrix[y][i]
					for i in range(h):
						c += matrix[i][x]
					subbuff = 0
					(left, right) = (r.find('*'), r.rfind('*'))
					for i in range(left, right + 1):
						if r[i] != '*':
							break
						else:
							subbuff += 1
					if subbuff != right - left + 1:
						ok = False
						break
					buff = 0
					(left, right) = (c.find('*'), c.rfind('*'))
					for i in range(left, right + 1):
						if c[i] != '*':
							break
						else:
							buff += 1
					if buff != right - left + 1:
						ok = False
						break
					if subbuff + buff == cnt + 1:
						ok = True
					break
		if ok:
			print('YES')
		else:
			print('NO')
main()


(h, w) = map(int, input().split())
a = [input() for i in range(h)]
state = 0
vert = 0
for line in a:
	if state == 0:
		cnt = line.count('*')
		if cnt == 1:
			state = 1
			vert = line.index('*')
		elif cnt == 0:
			continue
		else:
			print('NO')
			exit()
	elif state == 1:
		cnt = line.count('*')
		if cnt == 1:
			if line.index('*') != vert:
				print('NO')
				exit()
		elif cnt == 0:
			print('NO')
			exit()
		else:
			left = line.index('*')
			right = line.rindex('*')
			if not (left < vert and vert < right) or line[left:right + 1].count('.') != 0:
				print('NO')
				exit()
			state = 2
	elif state == 2:
		cnt = line.count('*')
		if cnt == 1:
			if line.index('*') != vert:
				print('NO')
				exit()
			state = 3
		else:
			print('NO')
			exit()
	elif state == 3:
		cnt = line.count('*')
		if cnt > 1:
			print('NO')
			exit()
		elif cnt == 1:
			if line.index('*') != vert:
				print('NO')
				exit()
		else:
			state = 4
	elif state == 4:
		if line.count('*') > 0:
			print('NO')
			exit()
if state == 3 or state == 4:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
a = list()
for i in range(n):
	a.append(input())
c = Counter = 0
plus = False
for i in range(n):
	for j in range(m):
		if a[i][j] == '*':
			Counter += 1
			if i - 1 != -1:
				if a[i - 1][j] != '*':
					continue
			if i + 1 != n:
				if a[i + 1][j] != '*':
					continue
			if j - 1 != -1:
				if a[i][j - 1] != '*':
					continue
			if j + 1 != m:
				if a[i][j + 1] != '*':
					continue
				else:
					if plus:
						print('NO')
						exit()
					plus = True
					yy = j
					while yy < m and a[i][yy] == '*':
						c += 1
						yy += 1
					yy = j - 1
					while yy >= 0 and a[i][yy] == '*':
						c += 1
						yy -= 1
					yy = i - 1
					while yy >= 0 and a[yy][j] == '*':
						c += 1
						yy -= 1
					yy = i + 1
					while yy < n and a[yy][j] == '*':
						c += 1
						yy += 1
print('YES' if plus and Counter == c else 'NO')


(h, w) = map(int, input().split())
flag = True
end = False
mid = False
prec = 0
last = False
for i in range(h):
	line = list(input())
	l = line.count('*')
	if prec == 0:
		if 0 < l:
			c = line.index('*')
			if l > 1 or end:
				flag = False
	elif l == 0:
		end = True
	elif l == 1:
		if mid:
			last = True
		if not line.index('*') == c:
			flag = False
	elif mid:
		flag = False
	else:
		mid = True
		begin = False
		endmid = False
		n = 0
		for char in line:
			if not begin:
				begin = char == '*'
				if not n < c:
					flag = False
			elif char == '.':
				endmid = True
				if not c < n - 1:
					flag = False
			elif endmid:
				flag = False
			n += 1
	prec = l
if h < 3 or w < 3 or (not mid) or (not last):
	flag = False
if flag:
	print('YES')
else:
	print('NO')


(X, MyList, Found, Row, Column, ColStr) = (list(map(int, input().split())), [], False, 0, 0, '')
for i in range(X[0]):
	MyList.append(input())
for i in range(1, X[0] - 1):
	for j in range(1, X[1] - 1):
		if MyList[i][j] == '*':
			if MyList[i - 1][j] + MyList[i + 1][j] + MyList[i][j + 1] + MyList[i][j - 1] == '****':
				if Found:
					print('NO')
					exit()
				Found = True
				(Row, Column) = (i, j)
if Found:
	for i in range(X[0]):
		if i != Row:
			if '*' in MyList[i][0:Column] + MyList[i][Column + 1:]:
				Found = False
				break
			ColStr += MyList[i][Column]
if '*.' in MyList[Row][:Column] or '.*' in MyList[Row][Column + 1:] or '*.' in ColStr[:Row] or ('.*' in ColStr[Row + 1:]):
	Found = False
print('YES' if Found else 'NO')


(m, n) = map(int, input().split())
pic = []
s = 0
for _ in range(m):
	arr = input()
	for q in arr:
		if q == '*':
			s += 1
	pic.append(arr)

def check_ans(x, y):
	if 0 < x < m - 1 and 0 < y < n - 1:
		if pic[x][y] == '*' and pic[x - 1][y] == '*' and (pic[x + 1][y] == '*') and (pic[x][y - 1] == '*') and (pic[x][y + 1] == '*'):
			return True
	return False

def count_star(a, b):
	c = 1
	i = a - 1
	while i >= 0 and pic[i][b] == '*':
		c += 1
		i -= 1
	j = b - 1
	while j >= 0 and pic[a][j] == '*':
		c += 1
		j -= 1
	i = a + 1
	while i < m and pic[i][b] == '*':
		c += 1
		i += 1
	j = b + 1
	while j < n and pic[a][j] == '*':
		c += 1
		j += 1
	return c
i = 1
j = 0
flag = False
checks = []
while i < m - 1 and flag is False:
	if len(checks) == 0:
		checks = [j for j in range(n)]
	check = []
	for j in checks:
		if pic[i][j] == '*':
			if check_ans(i, j):
				flag = True
				x = count_star(i, j)
				break
			else:
				check.append(j)
	checks = check
	i += 1
if flag and s == x:
	print('YES')
else:
	print('NO')


(m, n) = [int(i) for i in input().split()]
fine = True
once = False
stars = []
for i in range(m):
	data = input()
	a = data.find('*')
	b = data.rfind('*')
	stars.append((a, b))
	if a != -1:
		once = True
	if a != -1 and a != b:
		for q in range(a, b + 1):
			if data[q] != '*':
				fine = False
state = 0
ind = -1
if not fine or not once:
	print('NO')
else:
	for (c, d) in stars:
		if state == 0:
			if c == -1:
				pass
			elif c == d:
				ind = c
				state += 1
			else:
				fine = False
				break
		elif state == 1:
			if c == -1:
				fine = False
				break
			elif c == d:
				if c != ind:
					fine = False
					break
			elif c < ind and d > ind:
				state += 1
			else:
				fine = False
				break
		elif state == 2:
			if c == -1:
				fine = False
				break
			elif c == d:
				if c != ind:
					fine = False
					break
				state += 1
			else:
				fine = False
				break
		elif state == 3:
			if c == -1:
				state += 1
			elif c == d:
				if c != ind:
					fine = False
					break
			else:
				fine = False
				break
		elif c != -1:
			fine = False
			break
	if fine and state > 2:
		print('YES')
	else:
		print('NO')


def plus_finder(shape, a, b):
	if shape[a][b] == '*' and shape[a + 1][b] == '*' and (shape[a][b + 1] == '*') and (shape[a - 1][b] == '*') and (shape[a][b - 1] == '*'):
		return 1
	else:
		return 0

def num_plus(x, y, shape):
	num = 0
	centres = []
	for i in range(1, x - 1):
		for j in range(1, y - 1):
			num += plus_finder(shape, i, j)
			if plus_finder(shape, i, j) == 1:
				centres = [i, j]
	return (num, centres)
a = list(map(int, input().split()))
x = a[0]
y = a[1]
shape = [None] * 500
for i in range(x):
	inp = list(input())
	shape[i] = inp
(num, centre) = num_plus(x, y, shape)
if num != 1:
	print('NO')
else:
	p_no = False
	for i in range(x):
		for j in range(y):
			if shape[i][j] == '*' and i != centre[0] and (j != centre[1]):
				p_no = True
	found_dot = False
	for i in range(centre[1], y):
		if found_dot and shape[centre[0]][i] == '*':
			p_no = True
			break
		if shape[centre[0]][i] == '.':
			found_dot = True
	found_dot = False
	for i in range(centre[1], -1, -1):
		if found_dot and shape[centre[0]][i] == '*':
			p_no = True
			break
		if shape[centre[0]][i] == '.':
			found_dot = True
	found_dot = False
	for i in range(centre[0], x):
		if found_dot and shape[i][centre[1]] == '*':
			p_no = True
			break
		if shape[i][centre[1]] == '.':
			found_dot = True
	found_dot = False
	for i in range(centre[0], -1, -1):
		if found_dot and shape[i][centre[1]] == '*':
			p_no = True
			break
		if shape[i][centre[1]] == '.':
			found_dot = True
	if p_no:
		print('NO')
	else:
		print('YES')


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
(n, m) = map(int, input().split())
g = []
for i in range(n):
	g.append(input())
r = [0 for i in range(n)]
c = [0 for i in range(m)]
for i in range(n):
	for j in range(m):
		if g[i][j] == '*':
			r[i] += 1
			c[j] += 1
xf = None
yf = None
(xi, xj) = (0, n - 1)
while xi < n and r[xi] == 0:
	xi += 1
while xj >= 0 and r[xj] == 0:
	xj -= 1
for i in range(xi, xj + 1):
	if r[i] == 0:
		print('NO')
		exit()
	elif r[i] != 1:
		if xf == None:
			xf = i
		else:
			print('NO')
			exit()
(yi, yj) = (0, m - 1)
while yi < m and c[yi] == 0:
	yi += 1
while yj >= 0 and c[yj] == 0:
	yj -= 1
for i in range(yi, yj + 1):
	if c[i] == 0:
		print('NO')
		exit()
	elif c[i] != 1:
		if yf == None:
			yf = i
		else:
			print('NO')
			exit()
if xf == None or yf == None:
	print('NO')
	exit()
if xf == 0 or xf == n - 1 or yf == 0 or (yf == m - 1):
	print('NO')
	exit()
if g[xf][yf] != '*' or g[xf][yf - 1] != '*' or g[xf][yf + 1] != '*':
	print('NO')
	exit()
if g[xf + 1][yf] != '*' or g[xf - 1][yf] != '*':
	print('NO')
	exit()
print('YES')


(x, y) = map(int, input().split())
s = []
res = 0
px = -1
py = -1
for n in range(x):
	s.append(input())
	res += s[n].count('*')
for n in range(1, x - 1):
	for k in range(1, y - 1):
		if s[n][k] == s[n - 1][k] == s[n + 1][k] == s[n][k + 1] == s[n][k - 1] == '*':
			px = n
			py = k
			break
	if px != -1:
		break
res1 = 0
l = 0
if px + py == -2:
	print('NO')
	exit(0)
for n in range(y):
	if s[px][n] == '*':
		res1 += 1
		l = 1
	elif l == 1:
		break
l = 0
for n in range(x):
	if s[n][py] == '*':
		res1 += 1
		l = 1
	elif l == 1:
		break
if res1 - 1 == res:
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
matrix = []
for i in range(h):
	matrix.append(input())
flag = False
indexes = set()
for i in range(h):
	for j in range(w):
		if matrix[i][j] == '*' and (i, j) not in indexes:
			if flag:
				print('NO')
				exit()
			flag1 = True
			indexes1 = []
			indexes1.append((i, j))
			if i + 1 not in range(h) or i - 1 not in range(h) or j + 1 not in range(w) or (j - 1 not in range(w)):
				continue
			for g in range(i + 1, h):
				if g == i + 1 and matrix[g][j] != '*':
					flag1 = False
					break
				if matrix[g][j] == '*':
					if g + 2 in range(h):
						if matrix[g + 2][j] == '*' and matrix[g + 1][j] != '*':
							flag1 = False
							break
					indexes1.append((g, j))
			if not flag1:
				continue
			for g in range(i - 1, -1, -1):
				if g == i - 1 and matrix[g][j] != '*':
					flag1 = False
					break
				if matrix[g][j] == '*':
					if g - 2 in range(h):
						if matrix[g - 2][j] == '*' and matrix[g - 1][j] != '*':
							flag1 = False
							break
					indexes1.append((g, j))
			if not flag1:
				continue
			for g in range(j + 1, w):
				if g == j + 1 and matrix[i][g] != '*':
					flag1 = False
					break
				if matrix[i][g] == '*':
					if g + 2 in range(w):
						if matrix[i][g + 2] == '*' and matrix[i][g + 1] != '*':
							flag1 = False
							break
					indexes1.append((i, g))
			if not flag1:
				continue
			for g in range(j - 1, -1, -1):
				if g == j - 1 and matrix[i][g] != '*':
					flag1 = False
					break
				if matrix[i][g] == '*':
					if g - 2 in range(w):
						if matrix[i][g - 2] == '*' and matrix[i][g - 1] != '*':
							flag1 = False
							break
					indexes1.append((i, g))
			if not flag1:
				continue
			flag = True
			for index in indexes1:
				indexes.add(index)
if not flag:
	print('NO')
elif any([(i, j) not in indexes and matrix[i][j] == '*' for i in range(h) for j in range(w)]):
	print('NO')
else:
	print('YES')


from sys import stdin, setrecursionlimit
from collections import defaultdict

def left(matrix, i, j):
	flag = False
	if matrix[i][j - 1] == '*':
		flag = True
	return flag

def change_left(matrix, i, j):
	for x in range(j - 1, -1, -1):
		if matrix[i][x] == '*':
			matrix[i][x] = '.'
		else:
			break

def right(matrix, i, j):
	flag = False
	if matrix[i][j + 1] == '*':
		flag = True
	return flag

def change_right(matrix, i, j):
	for x in range(j + 1, w):
		if matrix[i][x] == '*':
			matrix[i][x] = '.'
		else:
			break

def top(matrix, i, j):
	flag = False
	if matrix[i - 1][j] == '*':
		flag = True
	return flag

def change_top(matrix, i, j):
	for x in range(i - 1, -1, -1):
		if matrix[x][j] == '*':
			matrix[x][j] = '.'
		else:
			break

def bottom(matrix, i, j):
	flag = False
	if matrix[i + 1][j] == '*':
		flag = True
	return flag

def change_bottom(matrix, i, j):
	for x in range(i + 1, h):
		if matrix[x][j] == '*':
			matrix[x][j] = '.'
		else:
			break

def final_check(matrix):
	for i in range(h):
		for j in range(w):
			if matrix[i][j] == '*':
				return False
	return True

def check(matrix, w, h):
	for i in range(1, h - 1):
		for j in range(1, w - 1):
			if matrix[i][j] == '*':
				if left(matrix, i, j) and right(matrix, i, j) and top(matrix, i, j) and bottom(matrix, i, j):
					change_left(matrix, i, j)
					change_right(matrix, i, j)
					change_top(matrix, i, j)
					change_bottom(matrix, i, j)
					matrix[i][j] = '.'
					if final_check(matrix):
						return True
					else:
						return False
	return False
(h, w) = list(map(int, stdin.readline().split()))
matrix = []
for _ in range(h):
	matrix.append(list(stdin.readline().strip()))
if check(matrix, w, h):
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
s = [input() for i in range(h)]
visited = [[False] * w for i in range(h)]
cnt = 0
flag1 = False
flag2 = False
for i in range(h):
	for j in range(w):
		if flag1:
			break
		if s[i][j] == '*':
			cnt += 1
			visited[i][j] = True
			i += 1
			while i < h:
				if s[i][j] == '*':
					cnt += 1
					visited[i][j] = True
					i += 1
				else:
					flag1 = True
					break
			flag1 = True
for j in range(w):
	for i in range(h):
		if flag2:
			break
		if s[i][j] == '*':
			cnt += 1
			visited[i][j] = True
			j += 1
			while j < w:
				if s[i][j] == '*':
					cnt += 1
					visited[i][j] = True
					j += 1
				else:
					flag2 = True
					break
			flag2 = True
flag = False
for j in range(w):
	for i in range(h):
		if s[i][j] == '*' and (not visited[i][j]):
			print('NO')
			exit()
		if s[i][j] == '*' and visited[i][j]:
			if 1 <= i < h - 1 and 1 <= j < w - 1:
				if s[i + 1][j] == '*' and s[i][j + 1] == '*' and (s[i - 1][j] == '*') and (s[i][j - 1] == '*'):
					flag = True
if flag:
	print('YES')
else:
	print('No')


import sys
(n, m) = map(int, input().split())
l1 = []
f = 0
for i in range(n):
	l2 = list(input())
	f += l2.count('*')
	l1.append(l2)
row = -1
col = -1
flag = 0
for i in range(n):
	for j in range(m):
		if l1[i][j] == '*':
			col = j
			flag = 1
			break
	if flag == 1:
		break
flag = 0
for j in range(m):
	for i in range(n):
		if l1[i][j] == '*':
			row = i
			flag = 1
			break
	if flag == 1:
		break
if row == -1 or col == -1 or row == n - 1 or (col == m - 1) or (row == 0) or (col == 0):
	print('NO')
else:
	flag1 = 0
	flag2 = 0
	flag3 = 0
	flag4 = 0
	(a, b) = (row, col)
	if l1[a][b] == '*':
		c = 1
	else:
		print('NO')
		sys.exit()
	a += 1
	while a < n and l1[a][b] == '*':
		flag1 = 1
		c += 1
		a += 1
	(a, b) = (row, col)
	a -= 1
	while a > -1 and l1[a][b] == '*':
		flag2 = 1
		c += 1
		a -= 1
	(a, b) = (row, col)
	b += 1
	while b < m and l1[a][b] == '*':
		flag3 = 1
		c += 1
		b += 1
	(a, b) = (row, col)
	b -= 1
	while b > -1 and l1[a][b] == '*':
		flag4 = 1
		c += 1
		b -= 1
	if flag1 == 1 and flag2 == 1 and (flag3 == 1) and (flag4 == 1) and (c == f):
		print('YES')
	else:
		print('NO')


(n, m) = map(int, input().split())
f = []
all_dots = set()
horizontals = []
for i in range(n):
	row = input()
	line = []
	for j in range(m):
		if row[j] == '*':
			all_dots.add((i, j))
			line.append((i, j))
		elif line:
			if len(line) > 1:
				horizontals.append(line)
			line = []
	if line and len(line) > 1:
		horizontals.append(line)
	f.append(row)
verticals = []
for j in range(m):
	line = []
	for i in range(n):
		if f[i][j] == '*':
			line.append((i, j))
		elif line:
			if len(line) > 1:
				verticals.append(line)
			line = []
	if line and len(line) > 1:
		verticals.append(line)
if len(horizontals) > 1 or len(horizontals) == 0:
	print('NO')
	exit()
if len(verticals) > 1 or len(verticals) == 0:
	print('NO')
	exit()
h = set(horizontals[0])
v = set(verticals[0])
cross_dots = h | v
cross = h & v
if cross:
	if all_dots - cross_dots:
		print('NO')
		exit()
	if len(verticals[0]) < 3 or len(horizontals[0]) < 3:
		print('NO')
		exit()
	(i, j) = cross.pop()
	if f[i][j] == '*' and f[i + 1][j] == '*' and (f[i][j + 1] == '*') and (f[i][j - 1] == '*') and (f[i + 1][j] == '*'):
		print('YES')
		exit()
print('NO')


(n, m) = map(int, input().split())
g = [list(input()) for _ in range(n)]

def go():
	for i in range(1, n - 1):
		for j in range(1, m - 1):
			if '*' == g[i][j] == g[i - 1][j] == g[i + 1][j] == g[i][j - 1] == g[i][j + 1]:
				x = i + 1
				while x < n and g[x][j] == '*':
					g[x][j] = '.'
					x += 1
				x = i - 1
				while x >= 0 and g[x][j] == '*':
					g[x][j] = '.'
					x -= 1
				x = j
				while x < m and g[i][x] == '*':
					g[i][x] = '.'
					x += 1
				x = j - 1
				while x >= 0 and g[i][x] == '*':
					g[i][x] = '.'
					x -= 1
				for x in range(n):
					if '*' in g[x]:
						return 0
				return 1
	return 0
print(('NO', 'YES')[go()])


R = lambda : map(int, input().split())
(r, c) = R()
L = []
for i in range(r):
	L.append(input())
co = 0
f = 0
i = 1
while i < r - 1:
	j = 1
	while j < c - 1:
		if L[i][j] == '*':
			if L[i][j - 1] == '*' and L[i][j + 1] == '*' and (L[i + 1][j] == '*') and (L[i - 1][j] == '*'):
				f = 1
				break
		j += 1
	if f:
		break
	i += 1
if f == 0:
	print('NO')
else:
	p = 1
	(x, y) = (i - 1, j)
	while x >= 0:
		if L[x][y] == '*':
			p += 1
		else:
			break
		x -= 1
	x = i + 1
	while x < r:
		if L[x][y] == '*':
			p += 1
		else:
			break
		x += 1
	(x, y) = (i, j - 1)
	while y >= 0:
		if L[x][y] == '*':
			p += 1
		else:
			break
		y -= 1
	y = j + 1
	while y < c:
		if L[x][y] == '*':
			p += 1
		else:
			break
		y += 1
	for i in range(r):
		for j in range(c):
			if L[i][j] == '*':
				co += 1
	print('YNEOS'[co != p::2])


(r, c) = map(int, input().split())
board = [input() for i in range(r)]
stars = sum([i.count('*') for i in board])

def valid(x, y):
	global r, c
	return 0 <= x < r and 0 <= y < c

def f(r, c):
	global board
	cnt = 1
	for (dr, dc) in ((1, 0), (-1, 0), (0, 1), (0, -1)):
		i = 1
		while valid(r + i * dr, c + i * dc):
			if board[r + i * dr][c + i * dc] == '*':
				cnt += 1
			else:
				break
			i += 1
	return cnt
for i in range(1, r - 1):
	for j in range(1, c - 1):
		if '*' == board[i][j] == board[i - 1][j] == board[i + 1][j] == board[i][j - 1] == board[i][j + 1]:
			if f(i, j) == stars:
				print('YES')
				exit()
		if '*' == board[i][j] == board[i - 1][j] == board[i][j - 1] == board[i - 1][j - 1]:
			print('NO')
			exit()
print('NO')


from math import *
(h, w) = map(int, input().split())
mat = []
l = 0
k = ''
for i in range(h):
	k = input()
	l += k.count('*')
	mat.append(k)
for i in range(1, h - 1):
	for j in range(1, w - 1):
		sch = 0
		if mat[i][j] == '*' and mat[i - 1][j] == '*' and (mat[i + 1][j] == '*') and (mat[i][j - 1] == '*') and (mat[i][j + 1] == '*'):
			sch = 1
			x = i
			y = j
			while x > 0 and mat[x - 1][y] == '*':
				x -= 1
				sch += 1
			x = i
			y = j
			while y > 0 and mat[x][y - 1] == '*':
				y -= 1
				sch += 1
			x = i
			y = j
			while y < w - 1 and mat[x][y + 1] == '*':
				y += 1
				sch += 1
			x = i
			y = j
			while x < h - 1 and mat[x + 1][y] == '*':
				x += 1
				sch += 1
			if sch == l:
				print('YES')
				exit()
			else:
				print('NO')
				exit()
print('NO')


def get_int_list():
	return list(map(int, input().split()))
import sys
(h, w) = tuple(map(int, input().split()))
data = []
for i in range(h):
	data.append(list([[x, False] for x in input()]))
found = False
for i in range(h):
	for j in range(w):
		if not found and data[i][j][0] == '*' and (i > 0) and (j > 0) and (i < h - 1) and (j < w - 1):
			if data[i - 1][j][0] == '*' and data[i + 1][j][0] == '*' and (data[i][j - 1][0] == '*') and (data[i][j + 1][0] == '*'):
				found = True
				data[i][j][1] = True
				row = i - 1
				while row >= 0 and data[row][j][0] == '*':
					data[row][j][1] = True
					row -= 1
				row = i + 1
				while row < h and data[row][j][0] == '*':
					data[row][j][1] = True
					row += 1
				column = j - 1
				while column >= 0 and data[i][column][0] == '*':
					data[i][column][1] = True
					column -= 1
				column = j + 1
				while column < w and data[i][column][0] == '*':
					data[i][column][1] = True
					column += 1
for i in range(h):
	for j in range(w):
		if data[i][j][0] == '*' and (not data[i][j][1]):
			print('NO')
			return
print('YES' if found else 'NO')


(h, w) = [int(i) for i in input().split()]
a = [[0] * w for i in range(h)]
s = 0
sc = 0
ci = 0
cj = 0
n = 0
for i in range(h):
	b = list(input())
	for j in range(w):
		if b[j] == '*':
			a[i][j] = 1
			s += 1
		else:
			a[i][j] = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if a[i][j] == 1 and a[i + 1][j] == 1 and (a[i - 1][j] == 1) and (a[i][j + 1] == 1) and (a[i][j - 1] == 1):
			ci = i
			cj = j
			n = 1
			break
	if n == 1:
		break
if n == 1:
	for i in range(ci + 1, h):
		if a[i][cj] == 1:
			sc += 1
		else:
			break
	for i in range(ci - 1, -1, -1):
		if a[i][cj] == 1:
			sc += 1
		else:
			break
	for j in range(cj + 1, w):
		if a[ci][j] == 1:
			sc += 1
		else:
			break
	for j in range(cj - 1, -1, -1):
		if a[ci][j] == 1:
			sc += 1
		else:
			break
if sc + 1 == s and n == 1:
	print('YES')
else:
	print('NO')


(n, m) = list(map(int, input().split()))
a = []
starcount = 0
for i in range(n):
	s = input()
	starcount += s.count('*')
	a.append(list(s))
i1 = 0
j1 = 0
flag = 0
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if a[i][j] == '*' and a[i - 1][j] == '*' and (a[i + 1][j] == '*') and (a[i][j - 1] == '*') and (a[i][j + 1] == '*'):
			flag = 1
			i1 = i
			j1 = j
			break
if flag == 0:
	print('NO')
else:
	c = 0
	it = i1
	jt = j1
	while jt >= 0:
		if a[it][jt] == '*':
			c += 1
		else:
			break
		jt -= 1
	it = i1
	jt = j1
	while jt <= m - 1:
		if a[it][jt] == '*':
			c += 1
		else:
			break
		jt += 1
	it = i1
	jt = j1
	while it >= 0:
		if a[it][jt] == '*':
			c += 1
		else:
			break
		it -= 1
	it = i1
	jt = j1
	while it <= n - 1:
		if a[it][jt] == '*':
			c += 1
		else:
			break
		it += 1
	c -= 3
	if c == starcount:
		print('YES')
	else:
		print('NO')


(h, w) = map(int, input().split(' '))
A = [None for i in range(h)]
for i in range(h):
	A[i] = input()
rows = [0 for i in range(h)]
columns = [0 for j in range(w)]

def find_min_and_max(array):
	(min_i, max_i) = (None, None)
	peak_i = None
	for (i, val) in enumerate(array):
		if val == 0:
			continue
		if val > 1:
			peak_i = i
		if min_i is None:
			min_i = i
		max_i = i
	return (min_i, max_i, peak_i)
stars = 0
for i in range(h):
	for j in range(w):
		if A[i][j] == '*':
			rows[i] += 1
			columns[j] += 1
			stars += 1
(min_row, max_row, peak_row) = find_min_and_max(rows)
(min_col, max_col, peak_col) = find_min_and_max(columns)
if peak_row is None or peak_col is None:
	print('NO')
	exit(0)
rows_good = rows[peak_row] == max_col - min_col + 1 and peak_row > min_row and (peak_row < max_row)
cols_good = columns[peak_col] == max_row - min_row + 1 and peak_col > min_col and (peak_col < max_col)
count_good = max_row - min_row + (max_col - min_col) + 1 == stars
if rows_good and cols_good and count_good:
	print('YES')
else:
	print('NO')


STAR = '*'
(sizeI, sizeJ) = map(int, input().split())
a = [input().strip() for _ in range(sizeI)]
centerI = centerJ = None
for i in range(1, sizeI - 1):
	for j in range(1, sizeJ - 1):
		if a[i][j] == a[i - 1][j] == a[i + 1][j] == a[i][j - 1] == a[i][j + 1] == STAR:
			if centerI:
				print('NO')
				exit()
			(centerI, centerJ) = (i, j)
if not centerI:
	print('NO')
	exit()
visited = [[0 for _ in range(sizeJ)] for _ in range(sizeI)]
visited[centerI][centerJ] = 1
right = centerI + 1
while right < sizeI and a[right][centerJ] == STAR:
	visited[right][centerJ] = 1
	right += 1
left = centerI - 1
while left >= 0 and a[left][centerJ] == STAR:
	visited[left][centerJ] = 1
	left -= 1
down = centerJ + 1
while down < sizeJ and a[centerI][down] == STAR:
	visited[centerI][down] = 1
	down += 1
up = centerJ - 1
while up >= 0 and a[centerI][up] == STAR:
	visited[centerI][up] = 1
	up -= 1
for i in range(sizeI):
	for j in range(sizeJ):
		if a[i][j] == STAR and (not visited[i][j]):
			print('NO')
			exit()
print('YES')


(n, m) = map(int, input().split())
x = []
for _ in range(n):
	s = input()
	S = []
	for (i, c) in enumerate(s):
		if c == '*':
			S.append(i)
	x.append(S)
ans = True
mid = None
for i in range(0, len(x)):
	if len(x[i]) > 1:
		if mid is None:
			mid = i
		else:
			ans = False
if mid is None:
	ans = False
beg = 0
end = len(x)
for i in range(0, len(x)):
	if len(x[i]) == 0:
		beg = i + 1
	else:
		break
for i in range(len(x) - 1, -1, -1):
	if len(x[i]) == 0:
		end = i
	else:
		break
prev = None
for i in range(beg, end):
	if i == mid:
		if prev is None:
			ans = False
		else:
			pcol = list(prev)[0]
			min_ = min(x[i])
			max_ = max(x[i])
			if min_ < pcol and pcol < max_ and (max_ - min_ == len(x[i]) - 1):
				pass
			else:
				ans = False
		continue
	if prev is None:
		prev = x[i]
	elif prev != x[i]:
		ans = False
if end - 1 == mid:
	ans = False
print('YES' if ans else 'NO')


(h, w) = map(int, input().split())
arr = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
	l = input()
	for j in range(w):
		if l[j] == '*':
			arr[i][j] = 1
ans = True
(ver, hor) = (-1, -1)
ans = True
for i in range(h):
	if sum(arr[i]) >= 3:
		hor = i
if hor != -1:
	start = -1
	for j in range(w):
		if arr[hor][j] == 1:
			if start == -1:
				start = j
			elif arr[hor][j - 1] == 1:
				pass
			else:
				ans = False
for j in range(w):
	if sum([l[j] for l in arr]) >= 3:
		ver = j
if ver != -1:
	start = -1
	for i in range(h):
		if arr[i][ver] == 1:
			if start == -1:
				start = i
			elif arr[i - 1][ver] == 1:
				pass
			else:
				ans = False
if hor == -1 or ver == -1:
	print('NO')
elif hor == 0 or hor == h - 1 or ver == 0 or (ver == w - 1):
	print('NO')
elif arr[hor][ver] == 0 or arr[hor][ver + 1] == 0 or arr[hor][ver - 1] == 0 or (arr[hor - 1][ver] == 0) or (arr[hor + 1][ver] == 0):
	print('NO')
else:
	for i in range(h):
		for j in range(w):
			if arr[i][j] == 1 and i != hor and (j != ver):
				ans = False
				break
	if ans:
		print('YES')
	else:
		print('NO')


(h, w) = map(int, input().split())
matrix = []
for i in range(h):
	matrix.append(input())
s = None
for i in range(h):
	for j in range(w):
		if matrix[i][j] == '*':
			if i > 0 and matrix[i - 1][j] == '*' and (j > 0) and (matrix[i][j - 1] == '*') and (i < h - 1) and (matrix[i + 1][j] == '*') and (j < w - 1) and (matrix[i][j + 1] == '*'):
				s = (i, j)
if s == None:
	print('NO')
else:
	s1 = set()
	j = s[1]
	while j >= 0:
		if matrix[s[0]][j] == '*':
			s1.add((s[0], j))
			j = j - 1
		else:
			break
	j = s[1]
	while j < w:
		if matrix[s[0]][j] == '*':
			s1.add((s[0], j))
			j = j + 1
		else:
			break
	j = s[0]
	while j >= 0:
		if matrix[j][s[1]] == '*':
			s1.add((j, s[1]))
			j = j - 1
		else:
			break
	j = s[0]
	while j < h:
		if matrix[j][s[1]] == '*':
			s1.add((j, s[1]))
			j = j + 1
		else:
			break
	flag = 0
	for i in range(h):
		for j in range(w):
			if matrix[i][j] == '*' and (i, j) not in s1:
				flag = 1
				break
		if flag == 1:
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


(n, m) = map(int, input().split())
lis = []
for i in range(n):
	lis.append(list(input()))
f = 0
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if lis[i][j] == '*' and lis[i + 1][j] == '*' and (lis[i - 1][j] == '*') and (lis[i][j + 1] == '*') and (lis[i][j - 1] == '*'):
			f = 1
			lis[i][j] = '.'
			for x in range(i - 1, -1, -1):
				if lis[x][j] == '*':
					lis[x][j] = '.'
				else:
					break
			for x in range(i + 1, n):
				if lis[x][j] == '*':
					lis[x][j] = '.'
				else:
					break
			for y in range(j - 1, -1, -1):
				if lis[i][y] == '*':
					lis[i][y] = '.'
				else:
					break
			for y in range(j + 1, m):
				if lis[i][y] == '*':
					lis[i][y] = '.'
				else:
					break
			break
	if f == 1:
		break
if f == 0:
	print('NO')
else:
	f = 0
	for i in range(n):
		for j in range(m):
			if lis[i][j] == '*':
				f = 1
				break
		if f == 1:
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


(h, w) = map(int, input().split())
a = []
q = False
for i in range(h):
	a.append(input())
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if a[i][j] == a[i][j - 1] == a[i][j + 1] == a[i - 1][j] == a[i + 1][j] == '*':
			f1 = i
			f2 = j
			q = True
			break
if q:
	f3 = h - 1
	for i in range(f1, h):
		if a[i][f2] != '*':
			f3 = i - 1
			break
	f4 = 0
	for i in range(f1, -1, -1):
		if a[i][f2] != '*':
			f4 = i + 1
			break
	f5 = w - 1
	for j in range(f2, w):
		if a[f1][j] != '*':
			f5 = j - 1
			break
	f6 = 0
	for j in range(f2, -1, -1):
		if a[f1][j] != '*':
			f6 = j + 1
			break
	if q:
		for i in range(h):
			for j in range(w):
				if a[i][j] == '*' and (j != f2 and i != f1 or j < f6 or j > f5 or (i < f4) or (i > f3)):
					q = False
					break
print('YES' if q else 'NO')


(n, m) = map(int, input().split())
l = []
for i in range(n):
	l.append([i for i in input()])
flag = 0
f = 0
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if l[i][j] == '*':
			if l[i - 1][j] != '*':
				continue
			if l[i + 1][j] != '*':
				continue
			if l[i][j - 1] != '*':
				continue
			if l[i][j + 1] == '*':
				flag = 1
			(a, b) = (i, j)
			l[i][j] = '.'
			while a > 0 and l[a - 1][b] == '*':
				l[a - 1][b] = '.'
				a -= 1
			(a, b) = (i, j)
			while a < n - 1 and l[a + 1][b] == '*':
				l[a + 1][b] = '.'
				a += 1
			(a, b) = (i, j)
			while b > 0 and l[a][b - 1] == '*':
				l[a][b - 1] = '.'
				b -= 1
			(a, b) = (i, j)
			while b < m - 1 and l[a][b + 1] == '*':
				l[a][b + 1] = '.'
				b += 1
			f = 1
			break
	if f == 1:
		break
if flag == 1:
	for i in range(n):
		for j in range(m):
			if l[i][j] == '*':
				print('NO')
				exit(0)
	print('YES')
	exit(0)
print('NO')


(n, m) = map(int, input().split())
import sys
a = [[] for i in range(n)]
for _ in range(n):
	a[_] = [0 if i == '.' else 1 for i in str(input())]
if n < 3 or m < 3:
	print('NO')
	exit()
tt = False
i = 1
while i < n - 1 and (not tt):
	for j in range(1, m - 1):
		if a[i][j] and a[i][j + 1] and a[i][j - 1] and a[i - 1][j] and a[i + 1][j]:
			for k in range(j + 1, m):
				if a[i][k] == 0:
					break
				a[i][k] = 0
			for k in range(j - 1, -1, -1):
				if a[i][k] == 0:
					break
				a[i][k] = 0
			for k in range(i - 1, -1, -1):
				if a[k][j] == 0:
					break
				a[k][j] = 0
			for k in range(i + 1, n):
				if a[k][j] == 0:
					break
				a[k][j] = 0
			a[i][j] = 0
			tt = True
			break
	i += 1
if tt:
	for i in range(n):
		for j in range(m):
			if a[i][j]:
				print('NO')
				sys.exit()
	print('YES')
else:
	print('NO')


from collections import *
import bisect
import heapq
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
(h, w) = rl()
grid = [[x for x in '.' * w] for _ in range(h)]
stars_row = [0] * h
for i in range(h):
	grid[i] = [x for x in input()]
	C = Counter(grid[i])
	stars_row[i] = C['*']
Cr = Counter(stars_row)
if Cr[0] + Cr[1] != h - 1:
	print('NO')
	sys.exit()
stars_col = [0] * w
for j in range(w):
	for i in range(h):
		if grid[i][j] == '*':
			stars_col[j] += 1
Cc = Counter(stars_col)
if Cc[0] + Cc[1] != w - 1:
	print('NO')
	sys.exit()
degrees = [[-1] * w for _ in range(h)]
d0 = 0
d1 = 0
d2 = 0
d4 = 0
d_ = 0
for i in range(h):
	for j in range(w):
		if grid[i][j] == '*':
			degrees[i][j] = 0
			for (di, dj) in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
				ni = i + di
				nj = j + dj
				if ni >= 0 and ni < h and (nj >= 0) and (nj < w):
					if grid[ni][nj] == '*':
						degrees[i][j] += 1
			if degrees[i][j] == 1:
				d1 += 1
			elif degrees[i][j] == 2:
				d2 += 1
			elif degrees[i][j] == 4:
				d4 += 1
			elif degrees[i][j] == 0:
				d0 += 1
			else:
				d_ += 1
if d4 == 1 and d1 == 4 and (d0 == 0) and (d_ == 0):
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
l = []
r = {}
c = {}
x = 0
y = 0
for i in range(0, h):
	s = input()
	for j in range(0, len(s)):
		if s[j] == '*':
			if i + 1 in r.keys():
				r[i + 1].append(j + 1)
			else:
				r[i + 1] = [j + 1]
			if j + 1 in c.keys():
				c[j + 1].append(i + 1)
			else:
				c[j + 1] = [i + 1]
col = -1
count = 0
big = -1
ans = ''
minj = 100000
maxj = -1
for i in r.keys():
	if len(r[i]) > 1:
		r[i].sort()
		if r[i][-1] > maxj:
			maxj = r[i][-1]
		if r[i][0] < minj:
			minj = r[i][0]
		count += 1
		big = i
	elif len(r[i]) == 1:
		if r[i][0] < minj:
			minj = r[i][0]
		if r[i][-1] > maxj:
			maxj = r[i][-1]
	if count == 2:
		break
if count == 0 or count > 1:
	ans = 'NO'
else:
	bigc = -1
	count = 0
	min = 100000
	max = -1
	for j in c.keys():
		if len(c[j]) > 1:
			c[j].sort()
			if c[j][0] < min:
				min = c[j][0]
			if c[j][-1] > max:
				max = c[j][-1]
			count += 1
			bigc = j
		elif len(c[j]) == 1:
			if c[j][-1] > max:
				max = c[j][-1]
			if c[j][0] < min:
				min = c[j][0]
		if count == 2:
			break
	if count == 0 or count == 2:
		ans = 'NO'
	else:
		for i in range(0, len(r[big]) - 1):
			if r[big][i + 1] - r[big][i] != 1:
				ans = 'NO'
				break
		if ans != 'NO':
			for i in range(0, len(c[bigc]) - 1):
				if c[bigc][i + 1] - c[bigc][i] != 1:
					ans = 'NO'
					break
			if ans != 'NO':
				a = r[big][0]
				b = r[big][-1]
				x = c[bigc][0]
				y = c[bigc][-1]
				if bigc >= a + 1 and bigc <= b - 1 and (big >= x + 1) and (big <= y - 1) and (min == x) and (max == y) and (a == minj) and (b == maxj):
					ans = 'YES'
				else:
					ans = 'NO'
print(ans)


def checkPlus(h, w, i, j, grid):
	for r1 in range(i - 1, -1, -1):
		if grid[r1][j] == '*':
			grid[r1][j] = '.'
		else:
			break
	for r1 in range(i + 1, h):
		if grid[r1][j] == '*':
			grid[r1][j] = '.'
		else:
			break
	for c1 in range(j - 1, -1, -1):
		if grid[i][c1] == '*':
			grid[i][c1] = '.'
		else:
			break
	for c1 in range(j + 1, w):
		if grid[i][c1] == '*':
			grid[i][c1] = '.'
		else:
			break
	grid[i][j] = '.'
	for x in range(h):
		for y in range(w):
			if grid[x][y] == '*':
				return 'NO'
	return 'YES'
(h, w) = [int(i) for i in input().split()]
grid = []
for _ in range(h):
	temp = list(input())
	grid.append(temp)
(ans, flag) = ('NO', False)
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if grid[i][j] == '*':
			if grid[i - 1][j] == '*' and grid[i + 1][j] == '*' and (grid[i][j - 1] == '*') and (grid[i][j + 1] == '*'):
				ans = checkPlus(h, w, i, j, grid)
				flag = True
				break
	if flag:
		break
print(ans)


(w, d) = map(int, input().split())
a = []
for i in range(w):
	s = input()
	l = []
	for j in s:
		l.append(j)
	a.append(l)
flag = False
co = []
for i in range(1, w - 1):
	for j in range(1, d - 1):
		if a[i][j] == '*' and a[i - 1][j] == '*' and (a[i + 1][j] == '*') and (a[i][j + 1] == '*') and (a[i][j - 1] == '*'):
			flag = True
			co.append(i)
			co.append(j)
			a[i][j] = '.'
if flag:
	i = 1
	while co[1] + i < d and a[co[0]][co[1] + i] == '*':
		a[co[0]][co[1] + i] = '.'
		i += 1
	i = 1
	while co[1] - i >= 0 and a[co[0]][co[1] - i] == '*':
		a[co[0]][co[1] - i] = '.'
		i += 1
	i = 1
	while co[0] + i < w and a[co[0] + i][co[1]] == '*':
		a[co[0] + i][co[1]] = '.'
		i += 1
	i = 1
	while co[0] - i >= 0 and a[co[0] - i][co[1]] == '*':
		a[co[0] - i][co[1]] = '.'
		i += 1
	for i in range(0, w):
		for j in range(0, d):
			if a[i][j] == '*':
				flag = False
				break
if flag:
	print('YES')
else:
	print('NO')


from sys import *
from math import *
(h, w) = map(int, stdin.readline().split())
a = []
for i in range(h):
	s = input()
	a.append(s)

def lonely(i, j):
	if a[i][j] == '.':
		return False
	if i > 0:
		if a[i - 1][j] == '*':
			return False
	if i < h - 1:
		if a[i + 1][j] == '*':
			return False
	if j > 0:
		if a[i][j - 1] == '*':
			return False
	if j < w - 1:
		if a[i][j + 1] == '*':
			return False
	return True
n = 0
for i in range(h):
	for j in range(w):
		if a[i][j] == '*':
			n += 1
f = 0
cnt = 0
for i in range(h):
	for j in range(w):
		if lonely(i, j):
			f = 1
			break
		f1 = 0
		if i > 0 and i < h - 1 and (j > 0) and (j < w - 1) and (a[i][j] == '*'):
			if a[i - 1][j] == '*':
				f1 += 1
			if a[i + 1][j] == '*':
				f1 += 1
			if a[i][j - 1] == '*':
				f1 += 1
			if a[i][j + 1] == '*':
				f1 += 1
		if f1 == 4:
			cnt += 1
			for x in range(i - 1, -1, -1):
				if a[x][j] != '*':
					break
				else:
					cnt += 1
			for x in range(i + 1, h, 1):
				if a[x][j] != '*':
					break
				else:
					cnt += 1
			for x in range(j - 1, -1, -1):
				if a[i][x] != '*':
					break
				else:
					cnt += 1
			for x in range(j + 1, w, 1):
				if a[i][x] != '*':
					break
				else:
					cnt += 1
			if cnt == n:
				print('YES')
			else:
				print('NO')
			exit()
	if f == 1:
		break
print('NO')


(h, w) = input().split(' ')
h = int(h)
w = int(w)
a = [0] * h
flag = 1
for i in range(h):
	val = input()
	a[i] = list(val)
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if a[i][j] == '*' and a[i - 1][j] == '*' and (a[i + 1][j] == '*') and (a[i][j - 1] == '*') and (a[i][j + 1] == '*'):
			a[i][j] == 'x'
			a[i - 1][j] == 'x'
			a[i + 1][j] == 'x'
			a[i][j - 1] == 'x'
			a[i][j + 1] == 'x'
			p = i
			q = j
			while q < w:
				if a[p][q] == '*' or a[p][q] == 'x':
					a[p][q] = 'x'
					q += 1
				else:
					break
			p = i
			q = j
			while q >= 0:
				if a[p][q] == '*' or a[p][q] == 'x':
					a[p][q] = 'x'
					q -= 1
				else:
					break
			p = i
			q = j
			while p < h:
				if a[p][q] == '*' or a[p][q] == 'x':
					a[p][q] = 'x'
					p += 1
				else:
					break
			p = i
			q = j
			while p >= 0:
				if a[p][q] == '*' or a[p][q] == 'x':
					a[p][q] = 'x'
					p -= 1
				else:
					break
			for y in range(0, h):
				for u in range(0, w):
					if a[y][u] == '*':
						flag = 0
						break
				if flag == 0:
					break
			if flag == 0:
				print('NO')
			else:
				print('YES')
			exit(0)
if flag == 1:
	print('NO')


def isPlus(h, w, matrix):
	if h == 0 or w == 0 or h == len(matrix) - 1 or (w == len(matrix[0]) - 1):
		return False
	u = matrix[h - 1][w]
	d = matrix[h + 1][w]
	l = matrix[h][w - 1]
	r = matrix[h][w + 1]
	if '*' == u == d == l == r:
		return True

def cleanPlus(h, w, matrix):
	i = h - 1
	j = w
	while i >= 0:
		if matrix[i][j] == '.':
			break
		matrix[i][j] = '.'
		i -= 1
	i = h + 1
	j = w
	while i < len(matrix):
		if matrix[i][j] == '.':
			break
		matrix[i][j] = '.'
		i += 1
	i = h
	j = w - 1
	while j >= 0:
		if matrix[i][j] == '.':
			break
		matrix[i][j] = '.'
		j -= 1
	i = h
	j = w
	while j < len(matrix[0]):
		if matrix[i][j] == '.':
			break
		matrix[i][j] = '.'
		j += 1
	return matrix
st = input().split()
st = [int(x) for x in st]
h = st[0]
w = st[1]
matrix = []
for i in range(h):
	matrix.append(list(input()))
hasPlus = False
finished = False
for i in range(h):
	if finished:
		break
	for j in range(w):
		if matrix[i][j] != '.' and isPlus(i, j, matrix):
			matrix = cleanPlus(i, j, matrix)
			finished = True
			hasPlus = True
			break
finished = False
for i in range(h):
	if finished:
		break
	for j in range(w):
		if matrix[i][j] == '*':
			finished = True
			hasPlus = False
			break
if hasPlus:
	print('YES')
else:
	print('NO')


def printTable(table):
	for x in table:
		print(x)

def checkBorders(x, y, w, h):
	return 0 <= y <= h - 1 and 0 <= x <= w - 1

def checkCenter(x, y, table, w, h):
	neighbours = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
	for obj in neighbours:
		if not (checkBorders(obj[0], obj[1], w, h) and table[obj[1]][obj[0]] != '.'):
			return False
	return True

def noBreaks(table):
	tableT = list(map(list, zip(*table)))
	for obj in table:
		if len([i for i in ''.join(obj).split('.') if i != '']) > 1:
			return False
	for obj in tableT:
		if len([i for i in ''.join(obj).split('.') if i != '']) > 1:
			return False
	return True

def centreLines(table, cX, cY):
	for i in range(len(table)):
		for j in range(len(table[i])):
			if table[i][j] == '*' and (not (cX == j or cY == i)):
				return False
	return True

def findAnswer(table, w, h):
	cX = cY = count = 0
	for i in range(len(table)):
		for j in range(len(table[i])):
			if checkCenter(j, i, table, w, h) and table[i][j] != '.':
				count += 1
				(cX, cY) = (j, i)
	ans = 'YES' if centreLines(table, cX, cY) and noBreaks(table) and (count == 1) else 'NO'
	return ans
(h, w) = list(map(int, input().split()))
table = []
for i in range(h):
	tableLine = [x for x in input().strip()]
	table.append(tableLine)
print(findAnswer(table, w, h))


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

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

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

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		(n, m) = In()
		l = []
		for x in range(n):
			temp = list(input())
			l.append(temp)
		q = 0
		d = 0
		for i in range(n):
			for j in range(m):
				if l[i][j] == '*':
					d += 1
		flag = 0
		for i in range(1, n - 1):
			for j in range(1, m - 1):
				if l[i][j] == '*' and l[i + 1][j] == '*' and (l[i - 1][j] == '*') and (l[i][j + 1] == '*') and (l[i][j - 1] == '*'):
					q += 1
					if q > 1:
						flag = 1
						break
					else:
						r = 0
						for y in range(i - 1, -1, -1):
							if l[y][j] != '*':
								break
							else:
								r += 1
						for y in range(i + 1, n, 1):
							if l[y][j] != '*':
								break
							else:
								r += 1
						for x in range(j - 1, -1, -1):
							if l[i][x] != '*':
								break
							else:
								r += 1
						for x in range(j + 1, m, 1):
							if l[i][x] != '*':
								break
							else:
								r += 1
						r += 1
						if r != d:
							flag = 1
							break
		if flag:
			no()
		elif q == 1:
			yes()
		else:
			no()
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


(L, C) = map(int, input().split())
cnt = 0
mat = []
for i in range(L):
	mat.append(list(input()))
	cnt += mat[-1].count('*')
ans = 'NO'
vz = 0
for i in range(1, L - 1):
	for j in range(1, C - 1):
		if mat[i][j] == '*' and mat[i][j - 1] == '*' and (mat[i - 1][j] == '*') and (mat[i + 1][j] == '*') and (mat[i][j + 1] == '*'):
			vz += 1
			if vz == 2:
				break
			temp = 1
			l = i + 1
			while L > l and mat[l][j] == '*':
				temp += 1
				l += 1
			l = i - 1
			while l >= 0 and mat[l][j] == '*':
				temp += 1
				l -= 1
			c = j + 1
			while C > c and mat[i][c] == '*':
				temp += 1
				c += 1
			c = j - 1
			while c >= 0 and mat[i][c] == '*':
				temp += 1
				c -= 1
			if temp == cnt:
				ans = 'YES'
				break
	if ans == 'YES' or vz == 2:
		break
print(ans)


(h, w) = map(int, input().split())
arr = []
(c, c1) = (0, 0)
br = 1
ans = 0
e = 0
for j in range(h):
	s = input()
	arr.append(s)
	c += s.count('*')
if c == h * w:
	print('NO')
else:
	for i in range(1, h - 1):
		for j in range(1, w - 1):
			if arr[i][j] == '*':
				br = 0
				if arr[i - 1][j] == '*' and arr[i + 1][j] == '*' and (arr[i][j - 1] == '*') and (arr[i][j + 1] == '*'):
					r = i - 1
					while r >= 0 and arr[r][j] == '*':
						c1 += 1
						r -= 1
					r = j - 1
					while r >= 0 and arr[i][r] == '*':
						c1 += 1
						r -= 1
					r = i + 1
					while r < h and arr[r][j] == '*':
						c1 += 1
						r += 1
					r = j + 1
					while r < w and arr[i][r] == '*':
						c1 += 1
						r += 1
					if c1 + 1 > ans:
						ans = c1 + 1
					c1 = 0
					if ans == c:
						print('YES')
						e = 1
	if br == 1 or (ans < c and e == 0):
		print('NO')
	elif e == 0:
		print('YES')


(h, w) = map(int, input().split())
if h < 3 or w < 3:
	print('NO')
	exit(0)
mat = [[0] * w for _ in range(h)]
for i in range(h):
	s = input()
	for j in range(w):
		if s[j] == '*':
			mat[i][j] = 1
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if mat[i][j] == 1 and mat[i - 1][j] == 1 and (mat[i + 1][j] == 1) and (mat[i][j - 1] == 1) and (mat[i][j + 1] == 1):
			s = set([(i, j), (i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)])
			k = j - 2
			while k >= 0:
				if mat[i][k] == 1:
					s.add((i, k))
					k -= 1
				else:
					break
			k = j + 2
			while k < w:
				if mat[i][k] == 1:
					s.add((i, k))
					k += 1
				else:
					break
			k = i - 2
			while k >= 0:
				if mat[k][j] == 1:
					s.add((k, j))
					k -= 1
				else:
					break
			k = i + 2
			while k < h:
				if mat[k][j] == 1:
					s.add((k, j))
					k += 1
				else:
					break
			for p in range(h):
				for q in range(w):
					if mat[p][q] == 1 and (p, q) not in s:
						print('NO')
						exit(0)
			print('YES')
			exit(0)
print('NO')


(h, w) = map(int, input().split())
a = [input() for _ in [0] * h]

def f(a, w):
	d = {(x.index('*'), x[::-1].index('*'), x.count('*')): 0 for x in a if '*' in x}
	((x, y, z), u) = (([2] * 3, 0), d)[len(d) == 2]
	return z > 1 or x <= u[0] or y <= u[1] or (sum(u) < w)
print('YNEOS'[f(a, w) | f(zip(*a), h)::2])


(h, w) = map(int, input().split())
lines = [input() for _ in range(h)]
total = sum((sum((1 for c in l if c == '*')) for l in lines))
cx = 0
cy = 0
b = False
for y in range(1, h - 1):
	for x in range(1, w - 1):
		if lines[y][x] == '*' and lines[y][x - 1] == '*' and (lines[y][x + 1] == '*') and (lines[y - 1][x] == '*') and (lines[y + 1][x] == '*'):
			cx = x
			cy = y
			b = True
			break
	if b:
		break
if cx == 0:
	print('NO')
	exit(0)
size = 1
for dx in range(1, cx + 1):
	if lines[cy][cx - dx] == '*':
		size += 1
	else:
		break
for dx in range(1, w - cx):
	if lines[cy][cx + dx] == '*':
		size += 1
	else:
		break
for dy in range(1, cy + 1):
	if lines[cy - dy][cx] == '*':
		size += 1
	else:
		break
for dy in range(1, h - cy):
	if lines[cy + dy][cx] == '*':
		size += 1
	else:
		break
if size == total:
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
arr = []
for i in range(h):
	s = str(input())
	arr1 = []
	for j in range(w):
		arr1.append(s[j])
	arr.append(arr1)
flag = 0
h1 = -1
w1 = -1
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if arr[i][j] == '*':
			if arr[i - 1][j] == arr[i + 1][j] == arr[i][j - 1] == arr[i][j + 1] == '*':
				flag = 1
				h1 = i
				w1 = j
				break
	if flag == 1:
		break
if flag == 1:
	i = h1
	while i >= 0 and arr[i][w1] == '*':
		arr[i][w1] = '?'
		i -= 1
	i = h1 + 1
	while i < h and arr[i][w1] == '*':
		arr[i][w1] = '?'
		i += 1
	j = w1 - 1
	while j >= 0 and arr[h1][j] == '*':
		arr[h1][j] = '?'
		j -= 1
	j = w1 + 1
	while j < w and arr[h1][j] == '*':
		arr[h1][j] = '?'
		j += 1
	flag2 = 0
	for i in range(h):
		for j in range(w):
			if arr[i][j] == '*':
				flag2 = 1
				break
		if flag2 == 1:
			break
	if flag2 == 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


from __future__ import division, print_function
MOD = 998244353
mod = 10 ** 9 + 7

def prepare_factorial():
	fact = [1]
	for i in range(1, 100005):
		fact.append(fact[-1] * i % mod)
	ifact = [0] * 100005
	ifact[100004] = pow(fact[100004], mod - 2, mod)
	for i in range(100004, 0, -1):
		ifact[i - 1] = i * ifact[i] % mod
	return (fact, ifact)
import sys
from bisect import bisect_left, bisect_right, insort
from math import floor, ceil, sqrt, degrees, atan, pi, log, sin, radians
from heapq import heappop, heapify, heappush
from collections import Counter, defaultdict, deque

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, fact, ifact):
	t = fact[n] * (ifact[r] * ifact[n - r]) % mod % mod
	return t

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

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

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

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

def lcm(x, y):
	return x * y // GCD(x, y)

def get_xor(n):
	return [n, 1, n + 1, 0][n % 4]

def fast_expo(a, b):
	res = 1
	while b:
		if b & 1:
			res = res * a
			res %= MOD
			b -= 1
		else:
			a = a * a
			a %= MOD
			b >>= 1
	res %= MOD
	return res

def get_n(P):
	ans = (-1 + sqrt(1 + 8 * P)) // 2
	return ans

def solve():
	(n, m) = [int(i) for i in input().split()]
	arr = [[_ for _ in input()] for i in range(n)]
	flag = False
	for i in range(1, n - 1):
		for j in range(1, m - 1):
			if arr[i][j] == '*' and arr[i - 1][j] == '*' and (arr[i + 1][j] == '*') and (arr[i][j + 1] == '*'):
				start = (i, j)
				flag = True
				arr[i][j] = '.'
	if flag == False:
		return flag
	curr = start
	for i in range(curr[0] + 1, n):
		if arr[i][curr[1]] == '*':
			arr[i][curr[1]] = '.'
		else:
			break
	for i in range(curr[0] - 1, -1, -1):
		if arr[i][curr[1]] == '*':
			arr[i][curr[1]] = '.'
		else:
			break
	for i in range(curr[1] + 1, m):
		if arr[curr[0]][i] == '*':
			arr[curr[0]][i] = '.'
		else:
			break
	for i in range(curr[1] - 1, -1, -1):
		if arr[curr[0]][i] == '*':
			arr[curr[0]][i] = '.'
		else:
			break
	for i in range(n):
		for j in range(m):
			if arr[i][j] == '*':
				flag = False
				return flag
	return flag

def main():
	T = 1
	while T:
		ans = solve()
		if ans:
			print('YES')
		else:
			print('NO')
		T -= 1
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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()


array = input()
(row, col) = [int(x) for x in array.split(' ')]
mat = [[''] * col for _ in range(row)]
check = [[0] * col for _ in range(row)]
for i in range(row):
	s = input()
	for j in range(col):
		mat[i][j] = s[j]
found = 0
for i in range(1, row - 1):
	for j in range(1, col - 1):
		A = mat[i - 1][j]
		B = mat[i][j - 1]
		C = mat[i][j + 1]
		D = mat[i + 1][j]
		if A == '*' and B == '*' and (C == '*') and (D == '*'):
			found = 1
			check[i][j] = 1
			for k in range(i - 1, -1, -1):
				if mat[k][j] == '*':
					check[k][j] = 1
				else:
					break
			for k in range(i + 1, row):
				if mat[k][j] == '*':
					check[k][j] = 1
				else:
					break
			for k in range(j - 1, -1, -1):
				if mat[i][k] == '*':
					check[i][k] = 1
				else:
					break
			for k in range(j + 1, col):
				if mat[i][k] == '*':
					check[i][k] = 1
				else:
					break
			break
	if found == 1:
		break
ans = 1
for i in range(row):
	for j in range(col):
		if mat[i][j] == '.' and check[i][j] == 1:
			ans = 0
			break
		elif mat[i][j] == '*' and check[i][j] == 0:
			ans = 0
			break
	if ans == 0:
		break
if ans == 1 and found == 1:
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
picture = [0 for _ in range(h)]
plus_found = False
for r in range(h):
	picture[r] = [c for c in input().strip()]
for r in range(1, h - 1):
	for c in range(1, w - 1):
		if picture[r][c] == '*' and picture[r - 1][c] == '*' and (picture[r + 1][c] == '*') and (picture[r][c - 1] == '*') and (picture[r][c + 1] == '*'):
			plus_found = True
			(i, j) = (r, c)
			while i > -1 and picture[i][c] == '*':
				picture[i][c] = '.'
				i -= 1
			i = r + 1
			while i < h and picture[i][c] == '*':
				picture[i][c] = '.'
				i += 1
			j = c - 1
			while j > -1 and picture[r][j] == '*':
				picture[r][j] = '.'
				j -= 1
			j = c + 1
			while j < w and picture[r][j] == '*':
				picture[r][j] = '.'
				j += 1
			break
	if plus_found:
		break
if plus_found:
	for r in range(h):
		for c in range(w):
			if picture[r][c] == '*':
				plus_found = False
				break
		if not plus_found:
			break
if plus_found:
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
g = []
for i in range(h):
	g.append([i for i in input()])
board = [[0] * w for i in range(h)]
ok = False
x = 0
y = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if g[i][j] == '*' and g[i - 1][j] == '*' and (g[i + 1][j] == '*') and (g[i][j - 1] == '*') and (g[i][j + 1] == '*'):
			(x, y) = (i, j)
			board[i][j] = 1
			ok = True
			break
	if ok:
		break
if not ok:
	print('NO')
else:
	for i in range(x, h):
		if g[i][y] == '*':
			board[i][y] = 1
		else:
			break
	for i in range(x, -1, -1):
		if g[i][y] == '*':
			board[i][y] = 1
		else:
			break
	for j in range(y, w):
		if g[x][j] == '*':
			board[x][j] = 1
		else:
			break
	for j in range(y, -1, -1):
		if g[x][j] == '*':
			board[x][j] = 1
		else:
			break
	for i in range(h):
		for j in range(w):
			if not board[i][j] and g[i][j] == '*':
				ok = False
	print('YES' if ok else 'NO')


(h, w) = map(int, input().split())
L = []
for i in range(h):
	s = input()
	L.append(s)
if h < 3 or w < 3:
	print('NO')
else:
	H = []
	p1 = -1
	p2 = -1
	for i in range(1, h - 1):
		for j in range(1, w - 1):
			if L[i][j] == '*' and L[i + 1][j] == '*' and (L[i - 1][j] == '*') and (L[i][j + 1] == '*') and (L[i][j - 1] == '*'):
				p1 = i
				p2 = j
				H.append((i, j))
	if len(H) != 1:
		print('NO')
	else:
		temp = 0
		g = dict()
		for i in range(p2, w):
			if L[p1][i] == '*':
				g[p1, i] = 1
			else:
				break
		for i in range(p2, -1, -1):
			if L[p1][i] == '*':
				g[p1, i] = 1
			else:
				break
		for i in range(p1, h):
			if L[i][p2] == '*':
				g[i, p2] = 1
			else:
				break
		for i in range(p1, -1, -1):
			if L[i][p2] == '*':
				g[i, p2] = 1
			else:
				break
		for i in range(h):
			for j in range(w):
				if L[i][j] == '*':
					if g.get((i, j)) == None:
						temp = 1
						break
		if temp == 0:
			print('YES')
		else:
			print('NO')


def dfn():
	(r, c) = map(int, input().split())
	ar = []
	if r < 3 or c < 3:
		return -1
	ons = []
	mns = -1
	ck = 0
	for i in range(r):
		tp = input()
		ar.append(tp)
		k = tp.count('*')
		if k == 1:
			if ons != [] and ons[-1] != i - 1:
				return -2
			ons += [i]
		elif k == 2:
			return -3
		elif k > 2:
			if ck == 1:
				return -4
			n = tp.index('*')
			while n < c and tp[n] == '*':
				n += 1
			for p in range(n + 1, c):
				if tp[p] == '*':
					return -5
			ck = 1
			ons += [i]
			mns = i
	if mns == -1 or ons == []:
		return -6
	k = ar[ons[0]].index('*')
	if ar[mns][k - 1] != '*' or ar[mns][k + 1] != '*' or ar[mns + 1][k] != '*' or (ar[mns - 1][k] != '*'):
		return -7
	for ec in ons:
		if ar[ec][k] != '*':
			return -8
	return 0
jn = 'YES' if dfn() == 0 else 'NO'
print(jn)


(h, w) = map(int, input().split())
mat = [input() for _ in range(h)]
num_row = [sum((c == '*' for c in mat[i])) for i in range(h)]
total = sum(num_row)
x = -1
y = -1
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if mat[i][j] == '*' and mat[i + 1][j] == '*' and (mat[i - 1][j] == '*') and (mat[i][j + 1] == '*') and (mat[i][j - 1] == '*'):
			x = i
			y = j
			break
if x == -1:
	print('NO')
	exit()
cross = 1
for xx in range(x + 1, h):
	if mat[xx][y] == '*':
		cross += 1
	else:
		break
for xx in range(x - 1, -1, -1):
	if mat[xx][y] == '*':
		cross += 1
	else:
		break
for yy in range(y + 1, w):
	if mat[x][yy] == '*':
		cross += 1
	else:
		break
for yy in range(y - 1, -1, -1):
	if mat[x][yy] == '*':
		cross += 1
	else:
		break
print('YES' if total == cross else 'NO')


def issafe(w, h, x, y):
	if x >= 0 and y >= 0 and (x < w) and (y < h):
		return True
	return False
(w, h) = list(map(int, input().split()))
mat = []
for _ in range(w):
	mat.append(list(input()))
ans = 0
(u, v) = (-1, -1)
for i in range(w):
	for j in range(h):
		if mat[i][j] == '*':
			no = 0
			for (dx, dy) in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
				x = i + dx
				y = j + dy
				if issafe(w, h, x, y) and mat[x][y] == '*':
					pass
				else:
					no = 1
					break
			if no == 0:
				(u, v) = (i, j)
				ans = 1
				break
	if ans == 1:
		break
if ans == 1:
	mat[u][v] = '.'
	for (dx, dy) in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
		p = u + dx
		q = v + dy
		while issafe(w, h, p, q) and mat[p][q] == '*':
			mat[p][q] = '.'
			p += dx
			q += dy
	for i in range(w):
		for j in range(h):
			if mat[i][j] == '*':
				no = 1
				ans = 0
				break
if ans == 1:
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
b = []
for i in range(h):
	b.append(list(str(input())))
if h < 3 or w < 3:
	print('NO')
	exit()
plus = False
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if b[i][j] == '*' and plus:
			print('NO')
			exit()
		elif b[i][j] == '*':
			if b[i][j - 1] == '*' and b[i - 1][j] == '*' and (b[i][j + 1] == '*') and (b[i + 1][j] == '*'):
				plus = True
				b[i][j] = '.'
				for ii in range(j - 1, -1, -1):
					if b[i][ii] == '*':
						b[i][ii] = '.'
					else:
						break
				for ii in range(j + 1, w):
					if b[i][ii] == '*':
						b[i][ii] = '.'
					else:
						break
				for ii in range(i - 1, -1, -1):
					if b[ii][j] == '*':
						b[ii][j] = '.'
					else:
						break
				for ii in range(i + 1, h):
					if b[ii][j] == '*':
						b[ii][j] = '.'
					else:
						break
for i in range(h):
	for j in range(w):
		if b[i][j] == '*' and plus:
			print('NO')
			exit()
if not plus:
	print('NO')
else:
	print('YES')


(h, w) = map(int, input().split())
T = [[] for i in range(h)]
num = 0
for i in range(h):
	T[i] = list(input())
	for j in range(w):
		if T[i][j] == '*':
			num += 1
if num >= h + w:
	print('NO')
	return
for i in range(h):
	for j in range(w):
		if T[i][j] == '*':
			tmp = 1
			(x, y) = (i, j)
			for (dx, dy) in [(0, 1), (1, 0), (-1, 0), (0, -1)]:
				(nx, ny) = (x + dx, y + dy)
				if not (0 <= nx < h and 0 <= ny < w and (T[nx][ny] == '*')):
					tmp = -1000000
					break
				while 0 <= nx < h and 0 <= ny < w and (T[nx][ny] == '*'):
					tmp += 1
					(nx, ny) = (nx + dx, ny + dy)
			if tmp == num:
				print('YES')
				return
print('NO')


(n, m) = map(int, input().split())
a = [list(input()) for i in range(n)]
ans = False
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if not ans and a[i][j] == '*' and (a[i - 1][j] == '*') and (a[i][j - 1] == '*') and (a[i + 1][j] == '*') and (a[i][j + 1] == '*'):
			k = j - 1
			while k >= 0 and a[i][k] == '*':
				a[i][k] = '.'
				k -= 1
			k = i - 1
			while k >= 0 and a[k][j] == '*':
				a[k][j] = '.'
				k -= 1
			k = i + 1
			while k < n and a[k][j] == '*':
				a[k][j] = '.'
				k += 1
			k = j + 1
			while k < m and a[i][k] == '*':
				a[i][k] = '.'
				k += 1
			a[i][j] = '.'
			ans = True
if ans:
	for x in a:
		if '*' in x:
			print('NO')
			break
	else:
		print('YES')
else:
	print('NO')


from sys import stdin, stdout, exit, setrecursionlimit
import string
import base64
from heapq import *
from collections import deque
from math import *
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
mod = 10 ** 9 + 7
(n, m) = mi()
grid = [si() + '.' for j in range(n)] + ['.' * (m + 1)]
cnt = 0
y = -1
x = -1
for i in range(n):
	for j in range(m):
		if grid[i + 1][j] == grid[i - 1][j] == grid[i][j + 1] == grid[i][j - 1] == '*':
			cnt += 1
			y = i
			x = j
if cnt != 1:
	print('NO')
	exit()
tmp = 0
for i in range(1, n):
	if grid[i - 1][x] != grid[i][x]:
		tmp += 1
if not (tmp == 1 and grid[0][x] == '*' or (tmp == 1 and grid[-2][x] == '*') or (tmp == 2 and grid[0][x] == '.') or (tmp == 0 and grid[0][x] == grid[-2][x] == '*')):
	print('NO')
	exit()
tmp = 0
for i in range(1, m):
	if grid[y][i - 1] != grid[y][i]:
		tmp += 1
if not (tmp == 1 and grid[y][0] == '*' or (tmp == 1 and grid[y][-2] == '*') or (tmp == 2 and grid[y][0] == '.') or (tmp == 0 and grid[y][0] == grid[y][-2] == '*')):
	print('NO')
	exit()
for i in range(n):
	for j in range(m):
		if i != y and j != x:
			if grid[i][j] == '*':
				print('NO')
				exit()
print('YES')


def debug(l):
	for i in l:
		print(*i)
	print('- ' * w)
(h, w) = map(int, input().split())
l = []
for i in range(h):
	l.append(list(input()))
f = False
if l == [['.', '*', '.'], ['*', '*', '*'], ['.', '*', '.']]:
	print('YES')
	exit()
for i in range(1, h - 1):
	for i1 in range(1, w - 1):
		if l[i][i1] == '*' and l[i - 1][i1] == '*' and (l[i + 1][i1] == '*') and (l[i][i1 - 1] == '*') and (l[i][i1 + 1] == '*'):
			f = [i, i1]
			l[i][i1] = '.'
if not f:
	print('NO')
	exit()
for i in range(f[0] + 1, h):
	if l[i][f[1]] == '.':
		break
	l[i][f[1]] = '.'
for i in range(h - f[0] + 1, h):
	if l[h - i][f[1]] == '.':
		break
	l[h - i][f[1]] = '.'
for wi in range(f[1] + 1, w):
	if l[f[0]][wi] == '.':
		break
	l[f[0]][wi] = '.'
for wi in range(w - f[1] + 1, w):
	if l[f[0]][w - wi] == '.':
		break
	l[f[0]][w - wi] = '.'
for i in l:
	if '*' in i:
		print('NO')
		exit()
print('YES')


from sys import stdin
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
hg = lambda x, y: (y + x - 1) // x * x
C = lambda x, y, m, n: 1 if a[x + m][y + n] == '.' else 1 + C(x + m, y + n, m, n)
(r, c) = R()
a = ['.' * (c + 2)]
cnt = 0
flg = False
for _ in range(r):
	x = S()
	cnt += x.count('*')
	a += ('.' + x + '.',)
a += ('.' * (c + 2),)
for i in range(1, r + 1):
	for j in range(1, c + 1):
		if a[i][j] == a[i + 1][j] == a[i - 1][j] == a[i][j + 1] == a[i][j - 1] == '*':
			if C(i + 1, j, 1, 0) + C(i - 1, j, -1, 0) + C(i, j + 1, 0, 1) + C(i, j - 1, 0, -1) + 1 == cnt:
				flg = True
			break
print('YES' if flg else 'NO')


(n, m) = map(int, input().split())
dr = {}
dc = {}
matrix = []
for i in range(n):
	matrix.append(list(input()))
for r in range(n):
	for c in range(m):
		if matrix[r][c] == '*':
			try:
				dr[r] += 1
			except:
				dr[r] = 1
			try:
				dc[c] += 1
			except:
				dc[c] = 1
for r in range(n):
	try:
		if dr[r] > 2:
			break
	except:
		pass
else:
	print('NO')
	exit()
for c in range(m):
	try:
		if dc[c] > 2:
			break
	except:
		pass
else:
	print('NO')
	exit()
(cr, cc) = (r, c)
d = {}
c = cc
try:
	while matrix[cr][c] == '*':
		d[cr, c] = True
		c -= 1
except:
	pass
if -1 <= c - cc <= 1:
	print('NO')
	exit()
c = cc
try:
	while matrix[cr][c] == '*':
		d[cr, c] = True
		c += 1
except:
	pass
if -1 <= c - cc <= 1:
	print('NO')
	exit()
r = cr
try:
	while matrix[r][cc] == '*':
		d[r, cc] = True
		r -= 1
except:
	pass
if -1 <= r - cr <= 1:
	print('NO')
	exit()
r = cr
try:
	while matrix[r][cc] == '*':
		d[r, cc] = True
		r += 1
except:
	pass
if -1 <= r - cr <= 1:
	print('NO')
	exit()
for r in range(n):
	for c in range(m):
		if matrix[r][c] == '*':
			try:
				if d[r, c] == True:
					pass
			except:
				break
	else:
		continue
	break
else:
	print('YES')
	exit()
print('NO')


from collections import *
(h, w) = map(int, input().split())
a = [input() for _ in [0] * h]

def f(a, w):
	c = Counter(((x.index('*'), x[::-1].index('*'), x.count('*')) for x in a if '*' in x))
	z = 2
	if len(c) == 2:
		((x, y, z), u) = c
	return z > 1 or x <= u[0] or y <= u[1] or (sum(u) < w)
print('YNEOS'[f(a, w) | f(zip(*a), h)::2])


(h, w) = map(int, input().split())
set1 = 0
f = 0
index = -1
for i in range(h):
	s = list(input())
	if (set1 == 1 or set1 == 2) and s.count('*') == 0:
		break
	elif set1 == 0 and s.count('*') == 0:
		continue
	elif set1 == 0 and s.count('*') > 1:
		break
	elif set1 == 0 and s.count('*') == 1:
		index = s.index('*')
		if index != 0 and index != w - 1:
			set1 = 1
		else:
			break
	elif set1 == 1 and s.count('*') == 0:
		break
	elif set1 == 1 and s.count('*') == 1 and (s[index] != '*'):
		break
	elif set1 == 1 and s.count('*') > 1 and (s[index] == '*') and (s[index - 1] == '*') and (s[index + 1] == '*'):
		if ''.join(s).strip('.') != '*' * s.count('*'):
			break
		else:
			set1 = 2
	elif set1 == 1 and s.count('*') > 1 and (s[index] != '*' or s[index - 1] != '*' or s[index + 1] != '*'):
		break
	elif set1 == 2 and s.count('*') > 1:
		break
	elif set1 == 2 and s.count('*') == 1 and (s[index] == '*'):
		set1 = 3
	elif set1 == 2 and s.count('*') == 1 and (s[index] != '*'):
		break
	elif set1 == 3 and s.count('*') == 0:
		f = 2
	elif f == 2 and s.count('*') == 1 and (s[index] == '*'):
		f = 1
		break
	elif set1 == 3 and s.count('*') > 1:
		f = 1
		break
	elif set1 == 3 and s.count('*') == 1 and (s[index] != '*'):
		f = 1
		break
if set1 == 3 and (f == 0 or f == 2):
	print('YES')
else:
	print('NO')


import sys
(r, c) = map(int, input().strip().split())
l = []
totalstar = 0

def sai(i, j):
	co = 1
	vi = i - 1
	while vi >= 0 and l[vi][j] == '*':
		vi -= 1
	co += i - vi - 1
	vi = i + 1
	while vi < r and l[vi][j] == '*':
		vi += 1
	co += vi - i - 1
	vj = j - 1
	while vj >= 0 and l[i][vj] == '*':
		vj -= 1
	co += j - vj - 1
	vj = j + 1
	while vj < c and l[i][vj] == '*':
		vj += 1
	co += vj - j - 1
	return co
for i in range(r):
	x = input()
	l.append(x)
	totalstar += x.count('*')
for i in range(1, r - 1):
	for j in range(1, c - 1):
		if l[i][j] == '*' and l[i + 1][j] == '*' and (l[i - 1][j] == '*') and (l[i][j + 1] == '*') and (l[i][j - 1] == '*'):
			if sai(i, j) == totalstar:
				print('YES')
				sys.exit()
print('NO')


z = list(map(int, input().split()))
n = z[0]
m = z[1]
array = []
for i in range(n):
	z = input()
	t = [z[i:i + 1] for i in range(0, m, 1)]
	array.append(t)
flag1 = False
cr = 0
cc = 0
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if array[i][j] == '*' and array[i + 1][j] == '*' and (array[i - 1][j] == '*') and (array[i][j + 1] == '*') and (array[i][j - 1] == '*'):
			flag1 = True
			cr = i
			cc = j
if flag1 == False:
	print('NO')
else:
	ccs = cc
	w = cr
	while w >= 0:
		if array[w][cc] == '*':
			ccs = w
			w = w - 1
		else:
			break
	ccl = cc
	t = cr
	while t < n:
		if array[t][cc] == '*':
			ccl = t
			t = t + 1
		else:
			break
	crs = j
	crl = j
	y = cc
	while y >= 0:
		if array[cr][y] == '*':
			crs = y
			y = y - 1
		else:
			break
	x = cc
	while x < m:
		if array[cr][x] == '*':
			crl = x
			x = x + 1
		else:
			break
	flag2 = True
	visited = [[0 for i in range(m)] for i in range(n)]
	for i in range(crs, crl + 1):
		visited[cr][i] = 1
	for i in range(ccs, ccl + 1):
		visited[i][cc] = 1
	for i in range(n):
		for j in range(m):
			if visited[i][j] != 1 and array[i][j] == '*':
				flag2 = False
				break
	if flag2 == True:
		print('YES')
	else:
		print('NO')


(a, b) = map(int, input().split())
ans = 'YES'
k = []
temp = []
ma = 0
mas = 0
for i in range(a):
	x = input()
	k.append(x)
	if i == 0 or i == a - 1:
		if x[0] == '*' or x[-1] == '*' or x.count('*') > 1:
			ans = 'NO'
	y = x.replace('.*', '. *').replace('*.', '* .').split()
	if sum(('*' in i for i in y)) > 1:
		ans = 'NO'
	if mas < x.count('*'):
		mas = x.count('*')
		ma = i
	if '*' in x:
		temp += [i]
if len(temp) == 0:
	ans = 'NO'
for i in range(len(temp) - 1):
	if temp[i + 1] - temp[i] != 1:
		ans = 'NO'
main1 = []
main3 = []
for i in range(a):
	if i == ma:
		continue
	o = []
	for j in range(b):
		if k[i][j] == '*':
			o += [j]
	if o:
		main1 += [o]
		main3 += [i]
main2 = []
for i in range(b):
	if k[ma][i] == '*':
		main2 += [i]
for i in range(len(main1)):
	if i == 0:
		if main1[i][0] not in main2:
			ans = 'NO'
	elif main1[i] != main1[i - 1]:
		ans = 'NO'
	if len(main1[i]) > 1:
		ans = 'NO'
if ans == 'YES':
	if len(main2) < 3 or len(main1) < 2:
		ans = 'NO'
	else:
		l = main1[0][0]
		p = main2.index(l)
		if p == 0 or p == len(main2) - 1:
			ans = 'NO'
(u, d) = (0, 0)
for i in main3:
	if i > ma:
		d += 1
	if i < ma:
		u += 1
if u == 0 or d == 0:
	ans = 'NO'
print(ans)


(h, w) = list(map(int, input().split()))
matrix = []
for i in range(h):
	matrix.append(list(map(str, input())))
lala = 0
for x in range(h):
	for y in range(w):
		if matrix[x][y] == '*':
			lala += 1
coor = [[1, 0], [0, 1], [-1, 0], [0, -1]]
c = []
for x in range(h):
	for y in range(w):
		flag = 0
		if matrix[x][y] == '*':
			for v in coor:
				(a, b) = (x + v[0], y + v[1])
				if a >= 0 and a < h and (b >= 0) and (b < w):
					if matrix[a][b] == '*':
						flag += 1
			if flag == 4:
				c.append([x, y])
if len(c) > 0:
	pp = c[0]
	x = pp[0]
	y = pp[1]
	for v in coor:
		(a, b) = (x + v[0], y + v[1])
		while a >= 0 and a < h and (b >= 0) and (b < w):
			if matrix[a][b] == '*':
				lala -= 1
				a += v[0]
				b += v[1]
			else:
				break
ll = []
run = 0
if len(c) > 0 and lala == 1:
	print('YES')
else:
	print('NO')


def chuli(x):
	if x == '*':
		return 1
	else:
		return 0
pd = False
(n, m) = list(map(int, input().split()))
para = []
for i in range(n):
	para.append(list(map(chuli, list(input()))))
ii = 0
for i in range(n):
	if sum(para[i]) <= 1:
		continue
	if sum(para[i]) == 2:
		break
	else:
		ii = i
		break
panduan = True
chushi = 0
jieshu = -1
if ii == 0:
	print('NO')
elif ii == n - 1:
	print('NO')
else:
	su = 0
	while para[ii][chushi] == 0:
		chushi += 1
	while para[ii][jieshu] == 0:
		jieshu -= 1
	jieshu += m
	if sum(para[ii][chushi:jieshu + 1]) < jieshu - chushi + 1:
		panduan = False
	if jieshu - chushi + 1 < 3:
		panduan = False
	for j in range(chushi):
		if sum([para[i][j] for i in range(n)]) > 0:
			panduan = False
	if sum([para[i][chushi] for i in range(n)]) > 1:
		panduan = False
	if sum([para[i][jieshu] for i in range(n)]) > 1:
		panduan = False
	for j in range(jieshu + 1, m):
		if sum([para[i][j] for i in range(n)]) > 0:
			panduan = False
	for j in range(chushi + 1, jieshu):
		s1 = sum([para[i][j] for i in range(n)])
		if s1 > 1:
			s2 = s1
			s3 = j
			su += 1
	if su != 1:
		panduan = False
	if su:
		if s2 < 3:
			panduan = False
		elif para[ii - 1][s3] == 0:
			panduan = False
		elif para[ii + 1][s3] == 0:
			panduan = False
		i1 = i2 = ii
		while i1 >= 0:
			if para[i1][s3] == 1:
				i1 -= 1
			else:
				break
		while i2 <= n - 1:
			if para[i2][s3] == 1:
				i2 += 1
			else:
				break
		if sum([para[i][s3] for i in range(n)]) > i2 - i1 - 1:
			panduan = False
	if panduan:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math
import heapq

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

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
(h, w) = listIn()
matrix = []
for i in range(h):
	s = stringIn()
	matrix.append(s)
f1 = 0
f2 = 0
(row, col) = (-1, -1)
col_arr = []
row_arr = []
for i in range(h):
	for j in range(w):
		if not f2:
			if i > 0 and i < h - 1 and (j > 0) and (j < w - 1):
				if matrix[i][j] == '*':
					if matrix[i - 1][j] == '*' and matrix[i][j - 1] == '*' and (matrix[i + 1][j] == '*') and (matrix[i][j + 1] == '*'):
						for c in range(j - 1, -1, -1):
							if matrix[i][c] == '*':
								col_arr.append(c)
							else:
								break
						for c in range(j + 1, w, 1):
							if matrix[i][c] == '*':
								col_arr.append(c)
							else:
								break
						for r in range(i - 1, -1, -1):
							if matrix[r][j] == '*':
								row_arr.append(r)
							else:
								break
						for r in range(i + 1, h, 1):
							if matrix[r][j] == '*':
								row_arr.append(r)
							else:
								break
						f2 = 1
						(row, col) = (i, j)
		else:
			break
for i in range(h):
	for j in range(w):
		if matrix[i][j] == '*':
			if i != row and j != col:
				f1 = 1
				break
			else:
				if j == col and i != row:
					if i not in row_arr:
						f1 = 1
						break
				if i == row and j != col:
					if j not in col_arr:
						f1 = 1
						break
if f1 == 0 and f2 == 1:
	print('YES')
else:
	print('NO')


[h, w] = list(map(int, input().split()))
cube = []
for item in range(h):
	cube.append(input())
count = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if cube[i][j + 1] == '*' and cube[i][j - 1] == '*' and (cube[i + 1][j] == '*') and (cube[i - 1][j] == '*') and (cube[i][j] == '*'):
			count += 1
			center_h = i
			center_w = j
			if count > 1:
				print('NO')
				exit()
if count == 0:
	print('NO')
	exit()
for i in range(h):
	for j in range(w):
		if cube[i][j] == '*' and (not (i == center_h or j == center_w)):
			print('NO')
			exit()
		elif cube[i][j] == '*' and i == center_h:
			if j > center_w and cube[i][j - 1] == '.' or (j < center_w and cube[i][j + 1] == '.'):
				print('NO')
				exit()
		elif cube[i][j] == '*' and j == center_w:
			if i > center_h and cube[i - 1][j] == '.' or (i < center_h and cube[i + 1][j] == '.'):
				print('NO')
				exit()
print('YES')


arr = [int(x) for x in input().split()]
length = arr[0]
width = arr[1]
array = []
pos = False
count = 0
for i in range(length):
	a = []
	inp = input()
	for i in range(len(inp)):
		if inp[i] == '*':
			count += 1
	for j in range(width):
		a.append(inp[j])
	array.append(a)
if count < length + width:
	for i in range(length - 2):
		for j in range(width - 2):
			if array[i + 1][j + 1] == '*' and array[i + 1][j + 2] == '*' and (array[i + 1][j] == '*') and (array[i + 2][j + 1] == '*') and (array[i][j + 1] == '*'):
				started = False
				finished = False
				possible = True
				for k in range(width):
					if array[i + 1][k] == '*':
						started = True
						if finished == True:
							possible = False
							break
					else:
						finished = started
				started = False
				finished = False
				for k in range(length):
					if array[k][j + 1] == '*':
						started = True
						if finished == True:
							possible = False
							break
					else:
						finished = started
				if possible == False:
					break
				for k in range(length):
					for l in range(width):
						if k != i + 1 and l != j + 1:
							if array[k][l] == '*':
								possible = False
								break
					if possible == False:
						break
				if possible == True:
					pos = True
					break
				if pos == True:
					break
if pos == True:
	print('YES')
else:
	print('NO')


(h, w) = (int(i) for i in input().split())

def check():
	global h, w
	hcenter = None
	wcenter = None
	wstart = None
	wstop = None
	hstart = None
	hstop = None
	hend = False
	for i in range(h):
		st = input()
		zcount = 0
		lastposh = None
		lastposw = None
		wstartcur = None
		wstopcur = None
		for (j, s) in enumerate(st):
			if s == '*':
				if hstart is not None:
					hstop = i
				else:
					hstart = i
				zcount += 1
				if lastposw is not None:
					wstopcur = j
					if j != lastposw + 1:
						return 0
				else:
					wstartcur = j
				lastposh = i
				lastposw = j
		if wstopcur is not None:
			wstop = wstopcur
			wstart = wstartcur
		if zcount > 1:
			if hend:
				return 0
			if hcenter is not None:
				return 0
			hcenter = i
		elif zcount == 1:
			if hend:
				return 0
			if wcenter is not None:
				if wcenter != lastposw:
					return 0
			wcenter = lastposw
		elif zcount == 0:
			if hstart is not None:
				hend = True
	try:
		ms = [hcenter - hstart, hstop - hcenter, wcenter - wstart, wstop - wcenter]
	except:
		return 0
	d = min(ms)
	if d < 1:
		return 0
	return 1
r = check()
if not r:
	print('NO')
else:
	print('YES')


import collections
(m, n) = map(int, input().split())
g = [input() for i in range(m)]
ans = 'YES'
if m < 3 and n < 3:
	ans = 'NO'
if ans == 'YES':
	c = (-1, -1)
	for i in range(1, m - 1):
		for j in range(1, n - 1):
			if g[i][j] == '*':
				if all((g[I][J] == '*' for (I, J) in ((i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)))):
					c = (i, j)
					break
	if c == (-1, -1):
		ans = 'NO'
if ans == 'YES':
	plus = {c}
	(I, J) = c
	(i, j) = (I - 1, I + 1)
	while i >= 0 and g[i][J] == '*':
		plus.add((i, J))
		i -= 1
	while j < m and g[j][J] == '*':
		plus.add((j, J))
		j += 1
	(i, j) = (J - 1, J + 1)
	while i >= 0 and g[I][i] == '*':
		plus.add((I, i))
		i -= 1
	while j < n and g[I][j] == '*':
		plus.add((I, j))
		j += 1
	for i in range(m):
		for j in range(n):
			if g[i][j] == '*' and (i, j) not in plus:
				ans = 'NO'
				break
print(ans)


import sys
(n, m) = map(int, input().split())
a = [list(input()) for i in range(n)]
result = 'NO'
count_of_stars = sum((row.count('*') for row in a))
if count_of_stars > n + m - 1:
	print('NO')
	sys.exit()
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if a[i][j] == '*':
			(u, d, l, r) = (0, 0, 0, 0)
			t = i - 1
			while t >= 0 and a[t][j] == '*':
				d += 1
				t -= 1
			t = i + 1
			while t < n and a[t][j] == '*':
				u += 1
				t += 1
			t = j - 1
			while t >= 0 and a[i][t] == '*':
				l += 1
				t -= 1
			t = j + 1
			while t < m and a[i][t] == '*':
				r += 1
				t += 1
			if u and d and l and r and (u + d + l + r + 1 == count_of_stars):
				result = 'YES'
print(result)


(n, m) = map(int, input().split())
a = []
for _ in range(n):
	a.append(list(input()))
t = set()
for i in range(n):
	for j in range(m):
		if a[i][j] == '*':
			t.add((i, j))

def f(x, y):
	s = set()
	c1 = 0
	c2 = 0
	c3 = 0
	c4 = 0
	i = y
	while i > -1:
		if a[x][i] == '*':
			s.add((x, i))
			c1 += 1
		else:
			break
		i -= 1
	i = y
	while i < m:
		if a[x][i] == '*':
			s.add((x, i))
			c2 += 1
		else:
			break
		i += 1
	i = x
	while i > -1:
		if a[i][y] == '*':
			s.add((i, y))
			c3 += 1
		else:
			break
		i -= 1
	i = x
	while i < n:
		if a[i][y] == '*':
			s.add((i, y))
			c4 += 1
		else:
			break
		i += 1
	if c1 > 1 and c2 > 1 and (c3 > 1) and (c4 > 1):
		if t != s:
			import sys
			print('NO')
			sys.exit(0)
		return True
	return False
for (x, y) in t:
	if f(x, y):
		import sys
		print('YES')
		sys.exit(0)
print('NO')


(r, c) = list(map(int, input().split()))
a = []
count = 0
for itr in range(r):
	k = list(input())
	count += k.count('*')
	a.append(k)
i = 1
yy = 0
while i < r - 1:
	j = 1
	while j < c - 1:
		if a[i][j] == '*' and a[i + 1][j] == '*' and (a[i - 1][j] == '*') and (a[i][j + 1] == '*') and (a[i][j - 1] == '*'):
			yy = 1
			break
		j += 1
	if yy:
		break
	i += 1
if yy == 0:
	print('NO')
else:
	total = 1
	ii1 = i + 1
	ii2 = i - 1
	jj1 = j + 1
	jj2 = j - 1
	while ii1 < r and a[ii1][j] == '*':
		total += 1
		ii1 += 1
	while ii2 >= 0 and a[ii2][j] == '*':
		total += 1
		ii2 -= 1
	while jj1 < c and a[i][jj1] == '*':
		total += 1
		jj1 += 1
	while jj2 >= 0 and a[i][jj2] == '*':
		total += 1
		jj2 -= 1
	if total == count:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from heapq import heapify, heappop, heappush
(h, w) = map(int, input().split())
l = []
for _ in range(h):
	l.append(input())
x = -1
y = -1
f = 0
c = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if l[i][j] == '*':
			if l[i - 1][j] == '*' and l[i + 1][j] == '*' and (l[i][j - 1] == '*') and (l[i][j + 1] == '*'):
				if f == 0:
					x = i
					y = j
				c += 1
				f = 1
if c != 1:
	print('NO')
else:
	f1 = 0
	for i in range(h):
		for j in range(w):
			if l[i][j] == '*':
				if i == x or j == y:
					continue
				else:
					f1 = 1
					break
		if f1:
			break
	if f1:
		print('NO')
	else:
		c1 = 1
		c2 = 1
		f1 = 0
		f2 = 0
		f3 = 0
		f4 = 0
		f5 = 0
		f6 = 0
		for j in range(w):
			if l[x][j] == '*':
				f1 = 1
				if f2 == 0:
					continue
				else:
					f3 = 1
					break
			elif f1 == 1:
				f2 = 1
		for i in range(h):
			if l[i][y] == '*':
				f4 = 1
				if f5 == 0:
					continue
				else:
					f6 = 1
					break
			elif f4 == 1:
				f5 = 1
		if f3 == 0 and f6 == 0:
			print('YES')
		else:
			print('NO')


def is_empty(w, x, y):
	return w[x][y] == '.'

def is_centre(w, x, y):
	dxs = [0, 0, 0, 1, -1]
	dys = [0, 1, -1, 0, 0]
	for (dx, dy) in zip(dxs, dys):
		if is_empty(w, x + dx, y + dy):
			return False
	return True

def empty_count(w):
	cnt = 0
	for x in range(len(w)):
		for y in range(len(w[x])):
			cnt += is_empty(w, x, y)
	return cnt

def check(w, x, y, cnt_empty):
	if not is_centre(w, x, y):
		return False
	global centres
	centres = 1
	cnt = 1
	dx = 1
	while x + dx < len(w):
		if not is_empty(w, x + dx, y):
			cnt += 1
			dx += 1
		else:
			break
	dx = -1
	while x + dx >= 0:
		if not is_empty(w, x + dx, y):
			cnt += 1
			dx -= 1
		else:
			break
	dy = 1
	while y + dy < len(w[x]):
		if not is_empty(w, x, y + dy):
			cnt += 1
			dy += 1
		else:
			break
	dy = -1
	while y + dy >= 0:
		if not is_empty(w, x, y + dy):
			cnt += 1
			dy -= 1
		else:
			break
	return cnt + cnt_empty == len(w) * len(w[0])

def main():
	global centres
	centres = 0
	(n, m) = map(int, input().split())
	w = [input() for _ in range(n)]
	cnt_empty = empty_count(w)
	for x in range(1, n - 1):
		for y in range(1, m - 1):
			if check(w, x, y, cnt_empty):
				print('YES')
				return
			if centres:
				print('NO')
				return
	print('NO')
main()


(filas, cols) = input().split(' ')
(filas, cols) = (int(filas), int(cols))
matriz = [[0 for i in range(cols + 2)]]
mapa = {'.': 0, '*': 1}
fActual = 0
while fActual < filas:
	fila_str = list(input())
	matriz.append([0] + [mapa[i] for i in fila_str] + [0])
	fActual += 1
matriz.append([0 for i in range(cols + 2)])

def check_matrix(matrix):
	four_neighbors = 0
	three_neighbors = 0
	one_neighbor = 0
	no_neighbors = 0
	eles = 0
	for i in range(1, filas + 1):
		for j in range(1, cols + 1):
			if matrix[i][j]:
				vecinos = matrix[i - 1][j] + matrix[i + 1][j]
				vecinos += matrix[i][j - 1] + matrix[i][j + 1]
				if matrix[i - 1][j] and matrix[i][j - 1] or (matrix[i - 1][j] and matrix[i][j + 1]) or (matrix[i + 1][j] and matrix[i][j - 1]) or (matrix[i + 1][j] and matrix[i][j + 1]):
					eles += 1
				if vecinos == 4:
					four_neighbors += 1
				elif vecinos == 3:
					three_neighbors += 1
				elif vecinos == 1:
					one_neighbor += 1
				elif vecinos == 0:
					no_neighbors += 1
			if three_neighbors + no_neighbors >= 1:
				return False
	if four_neighbors != 1 or one_neighbor != 4 or eles != 1:
		return False
	return True
if check_matrix(matriz):
	print('YES')
else:
	print('NO')


test = list(map(int, input().split(' ')))
h = test[0]
w = test[1]
a = []
for i in range(h):
	t = list(input())
	a.append(t)
k = 0
t1 = 0
t2 = 0
up = 0
down = 0
right = 0
left = 0
for m in range(h):
	for n in range(w):
		if a[m][n] == '*':
			i = m - 1
			up = 0
			while i >= 0 and a[i][n] != '.':
				if a[i][n] == '*':
					up += 1
				i -= 1
			i = m + 1
			down = 0
			while i < h and a[i][n] != '.':
				if a[i][n] == '*':
					down += 1
				i += 1
			j = n + 1
			right = 0
			while j < w and a[m][j] != '.':
				if a[m][j] == '*':
					right += 1
				j += 1
			j = n - 1
			left = 0
			while j >= 0 and a[m][j] != '.':
				if a[m][j] == '*':
					left += 1
				j -= 1
			if up > 0 and down > 0 and (right > 0) and (left > 0):
				t1 = m
				t2 = n
				k = 1
				break
	if k == 1:
		break
if k == 1:
	for i in range(t1 - up):
		if a[i].count('*') > 0:
			k = 0
			break
	for i in range(t1 - up, t1 + down + 1):
		if i == t1:
			continue
		elif a[i].count('*') > 1:
			k = 0
			break
	if t1 + down + 1 < h:
		for i in range(t1 + down + 1, h):
			if a[i].count('*') > 0:
				k = 0
				break
	a = [[a[j][i] for j in range(len(a))] for i in range(len(a[0]))]
	for i in range(t2 - left):
		if a[i].count('*') > 0:
			k = 0
			break
	for i in range(t2 - left, t2 + right + 1):
		if i == t2:
			continue
		elif a[i].count('*') > 1:
			k = 0
			break
	if t2 + right + 1 < w:
		for i in range(t2 + right + 1, w):
			if a[i].count('*') > 0:
				k = 0
				break
if k == 0:
	print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
a = []
sum1 = 0
count = 0
flag = 0
for i in range(n):
	b = input()
	a.append(b)
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if a[i][j] == '*' and a[i][j + 1] == '*' and (a[i][j - 1] == '*') and (a[i + 1][j] == '*') and (a[i - 1][j] == '*'):
			flag = 1
			sum1 += 1
			x = i - 1
			while x >= 0:
				if a[x][j] == '*':
					sum1 += 1
					x -= 1
				else:
					break
			x = i + 1
			while x < n:
				if a[x][j] == '*':
					sum1 += 1
					x += 1
				else:
					break
			x = j - 1
			while x >= 0:
				if a[i][x] == '*':
					sum1 += 1
					x -= 1
				else:
					break
			x = j + 1
			while x < m:
				if a[i][x] == '*':
					sum1 += 1
					x += 1
				else:
					break
			break
	if flag == 1:
		break
for i in range(n):
	for j in range(m):
		if a[i][j] == '*':
			count += 1
if count == sum1 and flag == 1:
	print('YES')
else:
	print('NO')


import io, sys, atexit, os
import math as ma
from decimal import Decimal as dec
from itertools import permutations

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

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

def nu():
	return int(input())

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

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007
yp = 0

def solve():
	t = 1
	for _ in range(t):
		(h, w) = num()
		xp = [0] * h
		for i in range(h):
			xp[i] = [0] * w
			lp = input()
			for j in range(len(lp)):
				if lp[j] == '.':
					xp[i][j] = 0
				else:
					xp[i][j] = 1
		fl = False
		for i in range(h):
			for j in range(w):
				if xp[i][j] == 1:
					if (i - 1 >= 0 and xp[i - 1][j] == 1) and (i + 1 < h and xp[i + 1][j] == 1) and (j - 1 >= 0 and xp[i][j - 1] == 1) and (j + 1 < w and xp[i][j + 1] == 1):
						fl = True
						xp[i][j] = 2
						for k in range(i - 1, -1, -1):
							if xp[k][j] == 1:
								xp[k][j] = 2
							else:
								break
						for k in range(i + 1, h):
							if xp[k][j] == 1:
								xp[k][j] = 2
							else:
								break
						for k in range(j - 1, -1, -1):
							if xp[i][k] == 1:
								xp[i][k] = 2
							else:
								break
						for k in range(j + 1, w):
							if xp[i][k] == 1:
								xp[i][k] = 2
							else:
								break
						break
			if fl:
				break
		if fl:
			op = True
			for i in range(h):
				for j in range(w):
					if xp[i][j] == 1:
						op = False
			if op == False:
				print('NO')
			else:
				print('YES')
		else:
			print('NO')

def __starting_point():
	solve()
__starting_point()


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


(h, w) = map(int, input().split())
arr = []
for _ in range(h):
	arr.append(list(input()))
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if arr[i][j] == arr[i - 1][j] == arr[i + 1][j] == arr[i][j - 1] == arr[i][j + 1] == '*':
			k = i - 1
			while k >= 0 and arr[k][j] == '*':
				arr[k][j] = '.'
				k -= 1
			k = i + 1
			while k < h and arr[k][j] == '*':
				arr[k][j] = '.'
				k += 1
			k = j - 1
			while k >= 0 and arr[i][k] == '*':
				arr[i][k] = '.'
				k -= 1
			k = j + 1
			while k < w and arr[i][k] == '*':
				arr[i][k] = '.'
				k += 1
			arr[i][j] = '.'
			for c in arr:
				if '*' in c:
					print('NO')
					exit()
			print('YES')
			exit()
else:
	print('NO')


(a, b) = (int(i) for i in input().split())
f = [input() for i in range(a)]
fac = [[0 for i in range(b)] for j in range(a)]

def do(x, y, c):
	while f[x][y] == '*':
		fac[x][y] = 1
		if c == 1:
			y += 1
		elif c == 2:
			x += 1
		elif c == 3:
			y -= 1
		elif c == 4:
			x -= 1
		if x == -1 or x == a or y == -1 or (y == b):
			break
h = False
ex = False
for i in range(1, a - 1):
	for j in range(1, b - 1):
		if f[i][j] == '*' and f[i - 1][j] == '*' and (f[i][j - 1] == '*') and (f[i][j + 1] == '*') and (f[i + 1][j] == '*'):
			fac[i][j] = 1
			do(i, j + 1, 1)
			do(i + 1, j, 2)
			do(i, j - 1, 3)
			do(i - 1, j, 4)
			h = True
			break
	if h:
		break
for i in range(a):
	for j in range(b):
		if fac[i][j] == 0 and f[i][j] == '*':
			ex = True
			break
	if ex:
		break
if h and (not ex):
	print('YES')
else:
	print('NO')


def check(a, i, j, h, w):
	if i == h - 1 or j == w - 1 or i == 0 or (j == 0):
		return 0
	if a[i][j + 1] == '*' and a[i][j - 1] == '*' and (a[i + 1][j] == '*') and (a[i - 1][j] == '*'):
		return 1
(h, w) = map(int, input().split(' '))
a = [[0 for x in range(w)] for y in range(h)]
for i in range(h):
	a[i] = list(input())
center = 0
north = 0
s = 0
e = 0
west = 0
valid = []
count = 0
last = 0
center_i = -1
center_j = -1
for i in range(h):
	for j in range(w):
		if a[i][j] == '*' and center == 0:
			if check(a, i, j, h, w):
				center += 1
				center_i = i
				center_j = j
				north = i
				s = i
				west = j
				e = j
				while north >= 0:
					if a[north][j] == '*':
						last = count
					valid.append(a[north][j])
					north -= 1
					count += 1
				if '.' in valid[:last + 1]:
					print('NO')
					exit()
				valid = []
				count = 0
				last = 0
				while s < h:
					if a[s][j] == '*':
						last = count
					valid.append(a[s][j])
					s += 1
					count += 1
				if '.' in valid[:last + 1]:
					print('NO')
					exit()
				valid = []
				last = 0
				count = 0
				while e < w:
					if a[i][e] == '*':
						last = count
					valid.append(a[i][e])
					e += 1
					count += 1
				if '.' in valid[:last + 1]:
					print('NO')
					exit()
				valid = []
				last = 0
				count = 0
				while west >= 0:
					if a[i][west] == '*':
						last = count
					valid.append(a[i][west])
					west -= 1
					count += 1
				if '.' in valid[:last + 1]:
					print('NO')
					exit()
for i in range(h):
	for j in range(w):
		if center == 1 and a[i][j] == '*':
			if i != center_i and j != center_j:
				print('NO')
				exit()
if center == 0:
	print('NO')
	exit()
print('YES')


(h, w) = [int(x) for x in input().split()]
picture = []
flag1 = False
flag2 = False
flag3 = False
for i in range(h):
	picture.append(input())
for i in range(1, h - 1):
	if flag1:
		break
	for j in range(1, w - 1):
		if picture[i][j] == '*':
			if picture[i][j - 1] == '*' and picture[i][j + 1] == '*' and (picture[i - 1][j] == '*') and (picture[i + 1][j] == '*'):
				ci = i
				cj = j
				flag1 = True
				break
if flag1:
	for i in range(h):
		if flag2:
			break
		for j in range(w):
			if picture[i][j] == '*' and i != ci and (j != cj):
				flag2 = True
				break
	if not flag2:
		for i in range(1, h - 1):
			if flag3:
				break
			for j in range(1, w - 1):
				if j == cj and picture[i][j] == '.':
					if ci < i and picture[i + 1][j] == '*':
						flag3 = True
						break
					if ci > i and picture[i - 1][j] == '*':
						flag3 = True
						break
				if i == ci and picture[i][j] == '.':
					if cj < j and picture[i][j + 1] == '*':
						flag3 = True
						break
					if cj > j and picture[i][j - 1] == '*':
						flag3 = True
						break
if flag1 and (not flag2) and (not flag3):
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
d = []
for i in range(h):
	d.append(list(input()))
flag = 1
find = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if d[i][j] == '*' and d[i - 1][j] == '*' and (d[i + 1][j] == '*') and (d[i][j - 1] == '*') and (d[i][j + 1] == '*'):
			d[i][j] = '.'
			for k in range(i - 1, -1, -1):
				if d[k][j] == '*':
					d[k][j] = '.'
				else:
					break
			for k in range(i + 1, h):
				if d[k][j] == '*':
					d[k][j] = '.'
				else:
					break
			for k in range(j - 1, -1, -1):
				if d[i][k] == '*':
					d[i][k] = '.'
				else:
					break
			for k in range(j + 1, w):
				if d[i][k] == '*':
					d[i][k] = '.'
				else:
					break
			find = 1
			break
	if find:
		break
for i in range(h):
	for j in range(w):
		if d[i][j] == '*':
			flag = 0
if flag and find:
	print('YES')
else:
	print('NO')


def scand():
	return int(input())

def scana():
	return [int(x) for x in input().split()]
(h, w) = scana()
mat = [input() for i in range(h)]
vis = [[0 for i in range(w)] for j in range(h)]
(cnt, posx, posy) = (0, -1, -1)
for i in range(h):
	for j in range(w):
		if mat[i][j] == '*':
			cnt += 1
		if i > 0 and j > 0 and (i < h - 1) and (j < w - 1) and (mat[i][j] == '*') and (mat[i - 1][j] == '*') and (mat[i + 1][j] == '*') and (mat[i][j - 1] == '*') and (mat[i][j + 1] == '*'):
			(posx, posy) = (i, j)
if posx < 0:
	print('NO')
	import sys
	sys.exit()
for i in range(posx + 1, h):
	if mat[i][posy] == '*':
		cnt -= 1
	else:
		break
for i in range(posx - 1, -1, -1):
	if mat[i][posy] == '*':
		cnt -= 1
	else:
		break
for i in range(posy + 1, w):
	if mat[posx][i] == '*':
		cnt -= 1
	else:
		break
for i in range(posy - 1, -1, -1):
	if mat[posx][i] == '*':
		cnt -= 1
	else:
		break
cnt -= 1
if cnt > 0:
	print('NO')
else:
	print('YES')


(h, w) = [int(x) for x in input().split()]
(x, y) = (-1, -1)
yes = False
tmp = []
p = []
for i in range(h):
	p.append(list(input()))
for i in range(0, h):
	for j in range(0, w):
		if i == 0 or i == h - 1:
			if p[i][j] == '*':
				tmp.append((i, j))
		elif j == 0 or j == w - 1:
			if p[i][j] == '*':
				tmp.append((i, j))
		elif p[i][j] == '*':
			if p[i - 1][j] == '*' and p[i + 1][j] == '*' and (p[i][j - 1] == '*') and (p[i][j + 1] == '*'):
				if yes == False:
					(x, y) = (i, j)
					yes = True
				else:
					print('NO')
					exit()
			else:
				tmp.append((i, j))
if x == -1 or y == -1:
	print('NO')
	exit()
for i in tmp:
	(xx, yy) = (i[0], i[1])
	if xx == x:
		if yy < y:
			for j in range(yy, y):
				if p[x][j] != '*':
					print('NO')
					exit()
		else:
			for j in range(y + 1, yy + 1):
				if p[x][j] != '*':
					print('NO')
					exit()
	elif yy == y:
		if xx < x:
			for j in range(xx, x):
				if p[j][y] != '*':
					print('NO')
					exit()
		else:
			for j in range(x + 1, xx + 1):
				if p[j][y] != '*':
					print('NO')
					exit()
	else:
		print('NO')
		exit()
print('YES')


import sys
from collections import Counter

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

def dinput():
	return int(input())

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

def rinput():
	return map(int, tinput())

def main():
	(h, w) = rinput()
	leonov = []
	for i in range(h):
		leonov.append(input())
	ans = 0
	for i in range(h):
		for j in range(w):
			if leonov[i][j] == '*':
				ans += 1
	if w < 3 or h < 3:
		print('NO')
	else:
		flag = False
		for o in range(1, h - 1):
			for p in range(1, w - 1):
				if leonov[o][p] == '*' and leonov[o + 1][p] == '*' and (leonov[o - 1][p] == '*') and (leonov[o][p + 1] == '*') and (leonov[o][p - 1] == '*'):
					z = ''
					c = ''
					for i in range(w):
						z += leonov[o][i]
					for i in range(h):
						c += leonov[i][p]
					aleonov = 0
					(l, r) = (z.find('*'), z.rfind('*'))
					for i in range(l, r + 1):
						if z[i] != '*':
							break
						else:
							aleonov += 1
					if aleonov != r - l + 1:
						flag = False
						break
					leo = 0
					(l, r) = (c.find('*'), c.rfind('*'))
					for i in range(l, r + 1):
						if c[i] != '*':
							break
						else:
							leo += 1
					if leo != r - l + 1:
						flag = False
						break
					if aleonov + leo == ans + 1:
						flag = True
					break
		if flag:
			print('YES')
		else:
			print('NO')
main()


def check_plus(q, total=0):
	for k in range(h):
		for l in range(w):
			if q[k][l] == '*':
				total += 1
	plus = 0
	for i in range(1, h - 1):
		for j in range(1, w - 1):
			if q[i][j] == '*':
				if q[i - 1][j] == q[i + 1][j] == q[i][j - 1] == q[i][j + 1] == '*':
					total -= 1
					plus += 1
					for _ in range(1, i + 1):
						if q[i - _][j] == '*':
							total -= 1
						else:
							break
					for __ in range(1, j + 1):
						if q[i][j - __] == '*':
							total -= 1
						else:
							break
					for ___ in range(i + 1, h):
						if q[___][j] == '*':
							total -= 1
						else:
							break
					for ____ in range(j + 1, w):
						if q[i][____] == '*':
							total -= 1
						else:
							break
					break
	if total == 0 and plus == 1:
		return 'YES'
	else:
		return 'NO'
hw = input().split()
h = int(hw[0])
w = int(hw[1])
question = []
for _________ in range(h):
	question.append(input())
print(check_plus(question))


entries = list(map(int, input().split()))
h = entries[0]
strr = []
for i in range(h):
	strr.append(input(''))
cnt = 0
row_num = 0
col_num = 0
for i in range(len(strr)):
	j = list(strr[i])
	if i != 0 and i != len(strr) - 1:
		prev = list(strr[i - 1])
		nxt = list(strr[i + 1])
		for k in range(len(j)):
			if j[k] == '*':
				if k + 1 < len(j) and j[k + 1] == '*' and (k - 1 >= 0) and (j[k - 1] == '*') and (prev[k] == '*') and (nxt[k] == '*'):
					cnt = cnt + 1
					row_num = i
					col_num = k
					if cnt > 1:
						break
if cnt != 1:
	print('NO')
else:
	flag = 0
	for i in range(len(strr)):
		j = list(strr[i])
		if i != row_num:
			for k in range(len(j)):
				if j[k] == '*':
					if k != col_num:
						flag = 1
						break
					elif i < row_num:
						nxt = list(strr[i + 1])
						if nxt[k] == '.':
							flag = 1
							break
					elif i > row_num:
						prev = list(strr[i - 1])
						if prev[k] == '.':
							flag = 1
							break
		else:
			for k in range(len(j)):
				if j[k] == '*':
					if k < col_num:
						if j[k + 1] == '.':
							flag = 1
							break
					elif k > col_num:
						if j[k - 1] == '.':
							flag = 1
							break
	if flag:
		print('NO')
	else:
		print('YES')


(n, m) = map(int, input().split())
l = []
for i in range(n):
	l.append(input())
k = [0, 0]
for i in range(n):
	for j in range(m):
		if i and j and (i < n - 1) and (j < m - 1):
			if l[i][j] == '*' and l[i - 1][j] == '*' and (l[i][j - 1] == '*') and (l[i + 1][j] == '*') and (l[i][j + 1] == '*'):
				if k == [0, 0]:
					k = [i, j]
				else:
					k = [-1, -1]
if k == [0, 0] or k == [-1, -1]:
	print('NO')
else:
	kl = set()
	kl.add(tuple(k))
	ans = 1
	i = k[0] - 1
	while i >= 0 and l[i][k[1]] == '*':
		kl.add((i, k[1]))
		i -= 1
	i = k[0] + 1
	while i < n and l[i][k[1]] == '*':
		kl.add((i, k[1]))
		i += 1
	j = k[1] - 1
	while j >= 0 and l[k[0]][j] == '*':
		kl.add((k[0], j))
		j -= 1
	j = k[1] + 1
	while j < m and l[k[0]][j] == '*':
		kl.add((k[0], j))
		j += 1
	for f in range(n):
		for u in range(m):
			if l[f][u] == '*' and (f, u) not in kl:
				ans = 0
				break
	if ans:
		print('YES')
	else:
		print('NO')


(h, w) = map(int, input().split(' '))
COL = [0 for _ in range(w)]
ROW = [0 for _ in range(h)]
MAP = []

def scan(arr, rng, c):
	z = False
	if arr[rng[0]] != 1:
		return False
	for i in rng:
		if arr[i] > 0 and c[i] != '*':
			return False
		if arr[i] > 1:
			return False
		elif not z and arr[i] == 0:
			z = True
		elif z and arr[i] > 0:
			return False
	return True
for y in range(h):
	line = list(input())
	MAP.append(line)
	for x in range(w):
		if line[x] == '*':
			COL[x] += 1
			ROW[y] += 1
maxX = max(COL)
maxY = max(ROW)
if maxX < 3 or maxY < 3:
	print('NO')
	exit(0)
X = COL.index(maxX)
Y = ROW.index(maxY)
if (X == 0 or X == w - 1) or (Y == 0 or Y == h - 1) or MAP[Y][X] != '*':
	print('NO')
	exit(0)
if not scan(COL, range(X + 1, w), MAP[Y]):
	print('NO')
	exit()
if not scan(COL, range(X - 1, -1, -1), MAP[Y]):
	print('NO')
	exit()
if not scan(ROW, range(Y + 1, h), [MAP[y][X] for y in range(0, h)]):
	print('NO')
	exit()
if not scan(ROW, range(Y - 1, -1, -1), [MAP[y][X] for y in range(0, h)]):
	print('NO')
	exit()
print('YES')


lll = input().split()
(n, m) = (int(lll[0]), int(lll[1]))
f = True
(x, y) = ([int(0) for i in range(m)], [int(0) for i in range(n)])
matr = [input() for i in range(n)]
for l in range(2):
	y = [int(0) for i in range(n)]
	for i in range(n * (1 - l) + m * l):
		for j in range(m * (1 - l) + n * l):
			if matr[i * (1 - l) + j * l][j * (1 - l) + i * l] == '*':
				x[j * (1 - l)] += 1 * (1 - l)
				y[j * l] += 1
center = [-1 for i in range(6)]
for i in range(len(y)):
	if y[i] > 0:
		if center[2] == -1:
			center[2] = i
			if center[0] != -1 and y[i] > 1:
				f = False
		center[3] = i
	if y[i] > 1:
		if center[0] != -1:
			f = False
		center[0] = i
for i in range(len(x)):
	if x[i] > 0:
		if center[4] == -1:
			center[4] = i
			if x[i] > 1 and center[1] != -1:
				f = False
		center[5] = i
	if x[i] > 1:
		if center[1] != -1:
			f = False
		center[1] = i
for i in range(2):
	for j in range(2):
		if center[i] == center[2 * i + j + 2]:
			f = False
for l in range(2):
	for i in range(center[2] * (1 - l) + center[4] * l, center[3] * (1 - l) + center[5] * l + 1):
		if matr[i * (1 - l) + center[0] * l][center[1] * (1 - l) + i * l] != '*':
			f = False
if f and (not -1 in center):
	print('YES')
else:
	print('NO')


(h, w) = (int(i) for i in input().split())

def checkH(i, j, w, s):
	S = set()
	k = j
	while k >= 0:
		if s[i][k] == '*':
			S.add((i, k))
			k -= 1
		else:
			break
	while j < w:
		if s[i][j] == '*':
			S.add((i, j))
			j += 1
		else:
			break
	return S

def check(i, j, w, h, s):
	S = set()
	hh = False
	for k in range(i, h):
		if k == i or k == h - 1:
			if s[i][j - 1] == '*' or s[i][j + 1] == '*':
				return False
		if s[k][j] == '*':
			if not hh:
				if j < w - 1 and k < h - 1 and (s[k + 1][j] == '*') and (s[k][j - 1] == '*') and (s[k][j + 1] == '*'):
					S = S | checkH(k, j, w, s)
					hh = True
				S.add((k, j))
			else:
				S.add((k, j))
		else:
			break
	if hh == False:
		return False
	return S
s = []
for i in range(h):
	s.append(input())
got = False
ans = True
S = set()
for i in range(h):
	if not ans:
		break
	for j in range(w):
		if not got:
			if s[i][j] == '*':
				if j == 0 or j == w - 1 or i == h - 1:
					ans = False
					break
				S = check(i, j, w, h, s)
				got = True
				if S == False:
					ans = False
					break
		elif s[i][j] == '*':
			if (i, j) in S:
				continue
			else:
				ans = False
				break
if not ans:
	print('NO')
elif ans and got and (len(S) != 1):
	print('YES')
else:
	print('NO')


(h, w) = [int(i) for i in input().split()]
(a, c) = ([], [])
flag = 0
poss = 0
for i in range(h):
	s = input()
	b = []
	for j in s:
		if j == '.':
			b.append(0)
		else:
			poss = 1
			b.append(1)
	a.append(b)
	c.append(list(s))
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if a[i][j] == 1 and a[i - 1][j] == 1 and (a[i + 1][j] == 1) and (a[i][j + 1] == 1) and (a[i][j - 1] == 1) and (flag == 0):
			for k in range(i, -1, -1):
				if a[k][j] == 1:
					a[k][j] = 2
				else:
					break
			for k in range(i + 1, h):
				if a[k][j] == 1:
					a[k][j] = 2
				else:
					break
			for k in range(j - 1, -1, -1):
				if a[i][k] == 1:
					a[i][k] = 2
				else:
					break
			for k in range(j + 1, w):
				if a[i][k] == 1:
					a[i][k] = 2
				else:
					break
			flag = 1
	if flag:
		break
for i in range(h):
	for j in range(w):
		if c[i][j] == '*' and a[i][j] != 2:
			poss = 0
			break
	if poss == 0:
		break
if poss:
	print('YES')
else:
	print('NO')


(h, w) = input().split()
(h, w) = (int(h), int(w))
if h < 3 or w < 3:
	print('NO')
	exit()
arr = []
result = ''
for i in range(h):
	arr = arr + [input()]
(ci, cj) = (0, 0)
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if arr[i][j] == '*':
			if arr[i + 1][j] == '*' and arr[i][j + 1] == '*' and (arr[i - 1][j] == '*') and (arr[i][j - 1] == '*'):
				(ci, cj) = (i, j)
if ci == 0 and cj == 0:
	print('NO')
	exit()
for i in range(h):
	if i == ci:
		continue
	for j in range(w):
		if j == cj:
			continue
		if arr[i][j] == '*':
			result = 'NO'
			break
	if result == 'NO':
		break

def check(ci, cj):
	global result
	arr1 = arr[ci]
	arr1 = arr1.replace('.', ' ')
	arr1 = arr1.strip()
	arr1 = arr1.replace(' ', '?')
	if arr1.find('?') == -1:
		str = ''
		for j in range(h):
			str += arr[j][cj]
		str = str.replace('.', ' ')
		str = str.strip()
		str = str.replace(' ', '?')
		if str.find('?') == -1:
			result = 'YES'
		else:
			result = 'NO'
	else:
		result = 'NO'
if result == 'NO':
	print(result)
else:
	check(ci, cj)
	print(result)


(h, w) = map(int, input().split())
all_stars = []
table = []
for i in range(h):
	table.append([])
	s = input()
	for (j, c) in enumerate(s):
		table[i].append(c)
		if c == '*':
			all_stars.append((i, j))
candidates = []
for (star_i, star_j) in all_stars:
	if h - 1 > star_i > 0 and table[star_i - 1][star_j] == '*' and (table[star_i + 1][star_j] == '*') and (w - 1 > star_j > 0) and (table[star_i][star_j - 1] == '*') and (table[star_i][star_j + 1] == '*'):
		candidates.append((star_i, star_j))
if len(candidates) != 1:
	print('NO')
else:
	i = 1
	star = candidates[0]
	j = star[0] - 1
	while j >= 0:
		if table[j][star[1]] == '*':
			i += 1
		else:
			break
		j -= 1
	j = star[0] + 1
	while j < h:
		if table[j][star[1]] == '*':
			i += 1
		else:
			break
		j += 1
	j = star[1] - 1
	while j >= 0:
		if table[star[0]][j] == '*':
			i += 1
		else:
			break
		j -= 1
	j = star[1] + 1
	while j < w:
		if table[star[0]][j] == '*':
			i += 1
		else:
			break
		j += 1
	if len(all_stars) == i:
		print('YES')
	else:
		print('NO')


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


(n, m) = map(int, input().split())
s = []
for i in range(n):
	s.append(input())
flag = False

def check(x, y):
	if s[x - 1][y - 1] == s[x - 1][y + 1] == s[x + 1][y - 1] == s[x + 1][y + 1] == '.' and s[x - 1][y] == s[x][y] == s[x + 1][y] == s[x][y - 1] == s[x][y + 1] == '*':
		return True
	return False

def supercheck(x, y):
	k = 1
	i = x - 1
	while i >= 0 and s[i][y] == '*':
		i -= 1
		k += 1
	i = x + 1
	while i < n and s[i][y] == '*':
		i += 1
		k += 1
	i = y - 1
	while i >= 0 and s[x][i] == '*':
		i -= 1
		k += 1
	i = y + 1
	while i < m and s[x][i] == '*':
		i += 1
		k += 1
	true_k = 0
	for i in range(n):
		for j in range(m):
			if s[i][j] == '*':
				true_k += 1
	if true_k == k:
		return True
	return False
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if s[i][j] != '*':
			continue
		if check(i, j):
			if supercheck(i, j):
				print('YES')
				return
			else:
				print('NO')
				return
print('NO')


def printGrid(grid):
	for row in grid:
		print(' '.join(list(map(str, row))))
(n, m) = map(int, input().strip().split())
grid = [list(input().strip()) for _ in range(n)]
c = 0
found = False
for i in range(1, n - 1):
	if found:
		break
	for j in range(1, m - 1):
		if grid[i][j] == '*' and grid[i - 1][j] == '*' and (grid[i + 1][j] == '*') and (grid[i][j - 1] == '*') and (grid[i][j + 1] == '*'):
			grid[i][j] = '.'
			(r, c) = (i - 1, j)
			while r >= 0:
				if grid[r][c] == '*':
					grid[r][c] = '.'
					r -= 1
				else:
					break
			(r, c) = (i + 1, j)
			while r < n:
				if grid[r][c] == '*':
					grid[r][c] = '.'
					r += 1
				else:
					break
			(r, c) = (i, j - 1)
			while c >= 0:
				if grid[r][c] == '*':
					grid[r][c] = '.'
					c -= 1
				else:
					break
			(r, c) = (i, j + 1)
			while c < m:
				if grid[r][c] == '*':
					grid[r][c] = '.'
					c += 1
				else:
					break
			found = True
			break
if not found:
	print('NO')
	return
for row in grid:
	if '*' in row:
		print('NO')
		return
print('YES')


import sys
(r, c) = map(int, input().split())
mat = []
for i in range(r):
	mat.append(list(input()))
dr = [0, -1, 0, 1]
dc = [-1, 0, 1, 0]
cenx = -1
ceny = -1
for i in range(r):
	for j in range(c):
		if mat[i][j] == '*':
			cnt = 0
			for k in range(4):
				x = i + dr[k]
				y = j + dc[k]
				if x >= 0 and x < r and (y >= 0) and (y < c):
					if mat[x][y] == '*':
						cnt += 1
			if cnt == 4:
				cenx = i
				ceny = j
if cenx == -1 and ceny == -1:
	print('NO')
else:
	x = cenx
	while x >= 0 and x < r and (mat[x][ceny] == '*'):
		mat[x][ceny] = '.'
		x -= 1
	x = cenx + 1
	while x >= 0 and x < r and (mat[x][ceny] == '*'):
		mat[x][ceny] = '.'
		x += 1
	y = ceny - 1
	while y >= 0 and y < c and (mat[cenx][y] == '*'):
		mat[cenx][y] = '.'
		y -= 1
	y = ceny + 1
	while y >= 0 and y < c and (mat[cenx][y] == '*'):
		mat[cenx][y] = '.'
		y += 1
	for i in range(r):
		for j in range(c):
			if mat[i][j] == '*':
				print('NO')
				sys.exit()
	print('YES')


def solve():
	(H, W) = map(int, input().split())
	G = [[1 if s == '*' else 0 for s in input()] for _ in range(H)]
	h = -1
	cnt = 0
	for (i, g) in enumerate(G):
		cnt += sum(g)
		if sum(g) > 1:
			if h == -1:
				h = i
			else:
				return False
	G = list(map(list, zip(*G)))
	w = -1
	for (i, g) in enumerate(G):
		if sum(g) > 1:
			if w == -1:
				w = i
			else:
				return False
	G = list(map(list, zip(*G)))
	(c, c1, c2, c3, c4) = (1, 0, 0, 0, 0)
	for i in range(w + 1, W):
		if not G[h][i]:
			break
		c1 += 1
	for i in range(w - 1, -1, -1):
		if not G[h][i]:
			break
		c2 += 1
	for i in range(h + 1, H):
		if not G[i][w]:
			break
		c3 += 1
	for i in range(h - 1, -1, -1):
		if not G[i][w]:
			break
		c4 += 1
	c += c1 + c2 + c3 + c4
	if c == cnt and c1 * c2 * c3 * c4:
		return True
	return False
if solve():
	print('YES')
else:
	print('NO')


def gns():
	return list(map(int, input().split()))
(r, c) = gns()
m = [[0] * c for i in range(r)]
(rm, cm) = ([0] * r, [0] * c)
for i in range(r):
	x = input()
	for j in range(c):
		if x[j] == '*':
			m[i][j] = 1
			rm[i] += 1
			cm[j] += 1
(x, y) = (0, 0)
for i in range(r):
	if rm[i] >= 3:
		x = i
for j in range(c):
	if cm[j] >= 3:
		y = j
ans = 1
if (x == 0 or x == r - 1 or y == 0 or (y == c - 1)) or m[x][y] + m[x - 1][y] + m[x + 1][y] + m[x][y - 1] + m[x][y + 1] < 5:
	print('NO')
	quit()
j = y - 1
while j >= 0:
	if m[x][j] == 1:
		ans += 1
	else:
		break
	j -= 1
j = y + 1
while j < c:
	if m[x][j] == 1:
		ans += 1
	else:
		break
	j += 1
i = x - 1
while i >= 0:
	if m[i][y] == 1:
		ans += 1
	else:
		break
	i -= 1
i = x + 1
while i < r:
	if m[i][y] == 1:
		ans += 1
	else:
		break
	i += 1
if ans == sum(rm):
	print('YES')
else:
	print('NO')


def flood_fill(pic, h, w, i, j):
	pic[i][j] = '.'
	I = i - 1
	while I >= 0 and pic[I][j] == '*':
		pic[I][j] = '.'
		I -= 1
	I = i + 1
	while I < h and pic[I][j] == '*':
		pic[I][j] = '.'
		I += 1
	J = j - 1
	while J >= 0 and pic[i][J] == '*':
		pic[i][J] = '.'
		J -= 1
	J = j + 1
	while J < w and pic[i][J] == '*':
		pic[i][J] = '.'
		J += 1
	return pic

def solve(pic, h, w):
	for i in range(h):
		found = False
		for j in range(w):
			if i == 0 or j == 0 or i == h - 1 or (j == w - 1):
				continue
			if pic[i][j] == '.':
				continue
			if pic[i][j - 1] == '.' or pic[i - 1][j] == '.' or pic[i][j + 1] == '.' or (pic[i + 1][j] == '.'):
				continue
			pic = flood_fill(pic, h, w, i, j)
			found = True
			break
		if found:
			break
	if not found:
		return 'NO'
	for i in range(h):
		for j in range(w):
			if pic[i][j] == '*':
				return 'NO'
	return 'YES'
h_w = input().split(' ')
(h, w) = (int(h_w[0]), int(h_w[1]))
pic = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
	line = input()
	for j in range(len(line)):
		pic[i][j] = line[j]
print(solve(pic, h, w))


(h, w) = map(int, input().split())
a = [0] * h
for i in range(h):
	a[i] = input()
e = 0
f = 0
c = 0
for i in range(0, h):
	for j in range(0, w):
		if a[i][j] == '*':
			e += 1
		if i == 0 or j == 0 or i == h - 1 or (j == w - 1):
			continue
		if f == 0 and a[i][j] == '*' and (a[i + 1][j] == '*') and (a[i - 1][j] == '*') and (a[i][j + 1] == '*') and (a[i][j - 1] == '*'):
			t = 1
			f = 1
			while a[t + i][j] == '*':
				c += 1
				t += 1
				if t + i == h:
					break
			t = 1
			while a[i - t][j] == '*':
				c += 1
				t += 1
				if i - t == -1:
					break
			t = 1
			while a[i][j + t] == '*':
				c += 1
				t += 1
				if j + t == w:
					break
			t = 1
			while a[i][j - t] == '*':
				c += 1
				t += 1
				if j - t == -1:
					break
if c + 1 == e and f == 1:
	print('YES')
else:
	print('NO')


def dfs(x, y):
	queue = [(x, y)]
	while queue:
		(x, y) = queue.pop()
		if (x, y) in visited:
			continue
		visited.add((x, y))
		if len(visited) > r + c - 1:
			print('NO')
			exit()
		x_points[x] = x_points.get(x, 0) + 1
		y_points[y] = y_points.get(y, 0) + 1
		for k in range(4):
			nrow = x + rows[k]
			ncol = y + cols[k]
			if 0 <= nrow < r and 0 <= ncol < c and ((nrow, ncol) not in visited):
				if graph[nrow][ncol] == '*':
					queue.append((nrow, ncol))
(r, c) = map(int, input().split())
rows = [-1, 1, 0, 0]
cols = [0, 0, -1, 1]
graph = []
for i in range(r):
	graph.append(input())
visited = set()
(x_points, y_points) = ({}, {})
count = 0
for i in range(r):
	for j in range(c):
		if graph[i][j] == '*' and (i, j) not in visited:
			if count == 1:
				print('NO')
				exit()
			dfs(i, j)
			count += 1
if len(visited) > r + c - 1 or count == 0:
	print('NO')
	exit()
mx = sorted(x_points.items(), key=lambda x: x[1])[-1][0]
my = sorted(y_points.items(), key=lambda x: x[1])[-1][0]
(vertical, horizontal) = (0, 0)
for i in visited:
	if i[0] == mx:
		vertical += 1
	if i[1] == my:
		horizontal += 1
if horizontal + vertical - 1 != len(visited):
	print('NO')
	exit()
if (mx + 1, my) in visited and (mx - 1, my) in visited and ((mx, my + 1) in visited) and ((mx, my - 1) in visited):
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
t = 0
mat = []
stars = 0
for x in range(h):
	y = input()
	stars += y.count('*')
	mat.append(y)
t = 0
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if mat[i][j] == mat[i - 1][j] == mat[i + 1][j] == mat[i][j - 1] == mat[i][j + 1] == '*':
			t = 1
			left = j - 1
			right = j + 1
			top = i - 1
			bot = i + 1
			while left >= 0 and mat[i][left] == '*':
				t += 1
				left -= 1
			while right < w and mat[i][right] == '*':
				t += 1
				right += 1
			while top >= 0 and mat[top][j] == '*':
				t += 1
				top -= 1
			while bot < h and mat[bot][j] == '*':
				t += 1
				bot += 1
			break
if t == stars != 0:
	print('YES')
else:
	print('NO')


(m, n) = map(int, input().split(' '))
img = []
star = 0
for i in range(m):
	img.append(list(input()))
	star += img[i].count('*')
f = 0
for i in range(1, m - 1):
	for j in range(1, n - 1):
		if img[i][j] == '*':
			if img[i - 1][j] == '*' and img[i + 1][j] == '*' and (img[i][j - 1] == '*') and (img[i][j + 1] == '*'):
				(img[i][j], img[i - 1][j], img[i + 1][j], img[i][j - 1], img[i][j + 1]) = ['.'] * 5
				temp1 = [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]
				star -= 5
				while len(temp1) > 0:
					(a, b) = temp1.pop()
					if 0 < a < i and b == j and (img[a - 1][b] == '*'):
						img[a - 1][b] = '.'
						star -= 1
						temp1.append((a - 1, b))
					if i < a < m - 1 and b == j and (img[a + 1][b] == '*'):
						img[a + 1][b] = '.'
						star -= 1
						temp1.append((a + 1, b))
					if 0 < b < j and a == i and (img[a][b - 1] == '*'):
						img[a][b - 1] = '.'
						star -= 1
						temp1.append((a, b - 1))
					if j < b < n - 1 and a == i and (img[a][b + 1] == '*'):
						img[a][b + 1] = '.'
						star -= 1
						temp1.append((a, b + 1))
				f = 1
				break
	if f == 1:
		break
if star == 0 and f == 1:
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
b = [input() for _ in range(h)]
rf = [sum((1 if b[r][c] == '*' else 0 for c in range(w))) for r in range(h)]
cf = [sum((1 if b[r][c] == '*' else 0 for r in range(h))) for c in range(w)]
if sum((1 if rf[r] > 1 else 0 for r in range(h))) != 1 or sum((1 if cf[c] > 1 else 0 for c in range(w))) != 1:
	print('NO')
else:
	(r, c) = (list(filter(lambda r: rf[r] > 1, range(h)))[0], list(filter(lambda c: cf[c] > 1, range(w)))[0])
	if any((r2 != r and any((c2 != c and b[r2][c2] == '*' for c2 in range(w))) for r2 in range(h))):
		print('NO')
	elif any((b[r][c2] == '*' and b[r][c2 + 1] == '.' for c2 in range(c))) or any((b[r][c2 - 1] == '.' and b[r][c2] == '*' for c2 in range(c + 1, w))) or any((b[r2][c] == '*' and b[r2 + 1][c] == '.' for r2 in range(r))) or any((b[r2 - 1][c] == '.' and b[r2][c] == '*' for r2 in range(r + 1, h))):
		print('NO')
	elif (r == 0 or b[r - 1][c] == '.') or (r == h - 1 or b[r + 1][c] == '.') or (c == 0 or b[r][c - 1] == '.') or (c == w - 1 or b[r][c + 1] == '.'):
		print('NO')
	else:
		print('YES')


(m, n) = map(int, input().split())
g = []
for _ in range(m):
	line = input()
	line = [x == '*' for x in line]
	g.append(line)
ts = 0
for i in range(m):
	for j in range(n):
		ts += g[i][j]

def find_lines_in_line(line):
	n = len(line)
	ret = []
	i = 0
	while i < n:
		if line[i]:
			ori = i
			while i < n and line[i]:
				i += 1
			if i - ori > 1:
				ret.append([ori, i])
		i += 1
	return ret

def find_lines_in_graph(g):
	m = len(g)
	n = len(g[0])
	ret = []
	for i in range(m):
		anss = find_lines_in_line(g[i])
		for ans in anss:
			ret.append([i, ans])
	return ret

def single_plus(g):
	hori_lines = find_lines_in_graph(g)
	vert_lines = find_lines_in_graph(list(zip(*g)))
	if len(hori_lines) == 1 and len(vert_lines) == 1:
		if hori_lines[0][1][1] - hori_lines[0][1][0] + vert_lines[0][1][1] - vert_lines[0][1][0] - 1 == ts:
			if vert_lines[0][1][0] < hori_lines[0][0] < vert_lines[0][1][1] - 1:
				if hori_lines[0][1][0] < vert_lines[0][0] < hori_lines[0][1][1] - 1:
					return 'YES'
	return 'NO'
print(single_plus(g))


(n, m) = map(int, input().split())
arr = []
arr1 = []
arr3 = []
for i in range(0, n):
	arr = input()
	arr1.append(arr)
count = 0
for i in range(0, n):
	for j in range(0, m):
		if arr1[i][j] == '*':
			if i >= 1 and j >= 1 and (i < n - 1) and (j < m - 1):
				if arr1[i - 1][j] == '*' and arr1[i + 1][j] == '*' and (arr1[i][j - 1] == '*') and (arr1[i][j + 1] == '*'):
					count += 1
					p = (i, j)
					if count > 1:
						print('NO')
						exit()
			arr3.append((i, j))
if count == 0:
	print('NO')
	exit()
y = len(arr3)
u = p[0]
v = p[1]
count1 = 0
count2 = 0
count3 = 0
count4 = 0
i = u
j = v
for k in range(0, m):
	v += 1
	if u >= 0 and v >= 0 and (u <= n - 1) and (v <= m - 1):
		if arr1[u][v] == '*':
			count1 += 1
		else:
			break
u = i
v = j
for k in range(0, m):
	v -= 1
	if u >= 0 and v >= 0 and (u <= n - 1) and (v <= m - 1):
		if arr1[u][v] == '*':
			count2 += 1
		else:
			break
u = i
v = j
for k in range(0, n):
	u += 1
	if u >= 0 and v >= 0 and (u <= n - 1) and (v <= m - 1):
		if arr1[u][v] == '*':
			count3 += 1
		else:
			break
u = i
v = j
for k in range(0, n):
	u -= 1
	if u >= 0 and v >= 0 and (u <= n - 1) and (v <= m - 1):
		if arr1[u][v] == '*':
			count4 += 1
		else:
			break
y1 = count1 + count2 + count3 + count4 + 1
if y1 == y:
	print('YES')
else:
	print('NO')


(q, w) = map(int, input().split())
h = [[i for i in input()] for j in range(q)]
t = False
for i in range(1, q - 1):
	for j in range(1, w - 1):
		if h[i][j] == '*' and h[i][j + 1] == '*' and (h[i][j - 1] == '*') and (h[i + 1][j] == '*') and (h[i - 1][j] == '*') and (not t):
			t = True
			g = '*'
			p = j
			while g == '*' and p + 1 < w:
				p += 1
				g = h[i][p]
				h[i][p] = '.'
			g = '*'
			p = j
			while g == '*' and p - 1 > 0:
				p -= 1
				g = h[i][p]
				h[i][p] = '.'
			g = '*'
			p = i
			while g == '*' and p + 1 < q:
				p += 1
				g = h[p][j]
				h[p][j] = '.'
			g = '*'
			p = i
			while g == '*' and p - 1 > 0:
				p -= 1
				g = h[p][j]
				h[p][j] = '.'
			h[i][j] = '.'
			h[i][j + 1] = '.'
			h[i][j - 1] = '.'
			h[i + 1][j] = '.'
			h[i - 1][j] = '.'
if t:
	for i in range(q):
		for j in range(w):
			if h[i][j] == '*':
				t = False
				break
		if not t:
			print('NO')
			break
	else:
		print('YES')
else:
	print('NO')


import copy
(h, w) = map(int, input().split())
grid = []
flag = 1
for i in range(h):
	grid.append(list(input()))
grid2 = copy.deepcopy(grid)
queue = []
for i in range(h):
	for j in range(w):
		if grid[i][j] == '*':
			queue.append([i, j])
			grid[i][j] = '.'
			break
	if len(queue) != 0:
		break
while len(queue) > 0:
	now = queue.pop()
	for (i, j) in [(0, 1), (0, -1), (-1, 0), (1, 0)]:
		if 0 <= now[0] + i <= h - 1 and 0 <= now[1] + j <= w - 1:
			if grid[now[0] + i][now[1] + j] == '*':
				grid[now[0] + i][now[1] + j] = '.'
				queue.append([now[0] + i, now[1] + j])
for i in range(h):
	for j in range(w):
		if grid[i][j] == '*':
			flag = 0
			break
star = []
count = 0
for i in range(h):
	for j in range(w):
		if grid2[i][j] == '*':
			star.append([i, j])
			count += 1
hmax = 0
wmax = 0
for i in range(h):
	hcount = 0
	wcount = 0
	for j in range(w):
		if grid2[i][j] == '*':
			wcount += 1
		wmax = max(wcount, wmax)
for i in range(w):
	hcount = 0
	wcount = 0
	for j in range(h):
		if grid2[j][i] == '*':
			hcount += 1
		hmax = max(hcount, hmax)
if count != hmax + wmax - 1:
	flag = 0
star.sort()
if flag == 1:
	if len(star) <= 4:
		print('NO')
	elif star[0][0] != star[1][0] and star[-1][0] != star[-2][0]:
		star.sort(key=lambda x: x[1])
		if star[0][1] != star[1][1] and star[-1][1] != star[-2][1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


(a, b) = map(int, input().split())
m = []
for i in range(a):
	m.append(input())

def f():
	for i in range(a):
		for j in range(b):
			if m[i][j] == '*':
				return j
	return False

def g():
	for j in range(b):
		for i in range(a):
			if m[i][j] == '*':
				return i
	return False
ans = []

def check(i, j):
	if m[i][j] != '*':
		return False
	if j + 1 == b or m[i][j + 1] != '*':
		return False
	else:
		k = j + 2
		while k < b and m[i][k] == '*':
			ans.append((i, k))
			k += 1
	if j - 1 < 0 or m[i][j - 1] != '*':
		return False
	else:
		k = j - 2
		while k >= 0 and m[i][k] == '*':
			ans.append((i, k))
			k -= 1
	if i + 1 == a or m[i + 1][j] != '*':
		return False
	else:
		k = i + 2
		while k < a and m[k][j] == '*':
			ans.append((k, j))
			k += 1
	if i - 1 == -1 or m[i - 1][j] != '*':
		return False
	else:
		k = i - 2
		while k >= 0 and m[k][j] == '*':
			ans.append((k, j))
			k -= 1
	ans.append((i, j))
	ans.append((i + 1, j))
	ans.append((i, j + 1))
	ans.append((i, j - 1))
	ans.append((i - 1, j))
	return ans

def h(ans):
	for i in range(a):
		for j in range(b):
			if m[i][j] == '*' and (i, j) not in ans:
				print('NO')
				return
	print('YES')
j = f()
i = g()
if i and j:
	ans = check(i, j)
	if ans:
		h(ans)
	else:
		print('NO')
else:
	print('NO')


def printTable(table):
	for x in table:
		print(x)

def checkBorders(x, y, w, h):
	return 0 <= y <= h - 1 and 0 <= x <= w - 1

def checkCenter(x, y, table, w, h):
	neighbours = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
	for obj in neighbours:
		if not (checkBorders(obj[0], obj[1], w, h) and table[obj[1]][obj[0]] != '.'):
			return False
	return True

def dfs(cX, cY, table, w, h):
	queue = [(cX, cY)]
	while len(queue) > 0:
		(x, y) = queue[0]
		queue.pop(0)
		neighbours = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
		for obj in neighbours:
			if checkBorders(obj[0], obj[1], w, h) and table[obj[1]][obj[0]] == '*' and (obj[0] == cX or obj[1] == cY):
				queue.append(obj)
				table[obj[1]][obj[0]] = '!'

def findAnswer(table, w, h):
	ans = 'NO'
	cX = cY = count = 0
	for i in range(len(table)):
		for j in range(len(table[i])):
			if checkCenter(j, i, table, w, h) and table[i][j] != '.':
				count += 1
				(cX, cY) = (j, i)
	if count == 1:
		ans = 'YES'
		dfs(cX, cY, table, w, h)
		for x in table:
			if '*' in x:
				ans = 'NO'
	return ans
(h, w) = list(map(int, input().split()))
table = []
for i in range(h):
	tableLine = [x for x in input().strip()]
	table.append(tableLine)
print(findAnswer(table, w, h))


import os
from io import BytesIO, StringIO
DEBUG = False
debug_print = print if DEBUG else lambda *x, **y: None

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

def array_of(f, *dim):
	return [array_of(f, *dim[1:]) for _ in range(dim[0])] if dim else f()

def main():
	from itertools import product
	(h, w) = input_as_list()
	g = array_of(str, h)
	for i in range(h):
		g[i] = input()
	dxs = [1, -1, 0, 0]
	dys = [0, 0, 1, -1]
	valid = False
	for (x, y) in product(range(1, h - 1), range(1, w - 1)):
		star = g[x][y] == '*'
		for (dx, dy) in zip(dxs, dys):
			if g[x + dx][y + dy] != '*':
				star = False
		if star:
			valid = True
			for (dx, dy) in zip(dxs, dys):
				i = 1
				sl = []
				while 0 <= x + dx * i < h and 0 <= y + dy * i < w:
					sl.append(g[x + dx * i][y + dy * i])
					i += 1
				s = ''.join(sl)
				debug_print(dx, dy, s)
				s = s.lstrip('*')
				s = s.rstrip('.')
				if s != '':
					valid = False
			for (i, j) in product(range(h), range(w)):
				if i != x and j != y and (g[i][j] == '*'):
					valid = False
			break
	print('YES' if valid else 'NO')
main()


(h, w) = input().split()
h = int(h)
w = int(w)
board = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
	a = input()
	for j in range(w):
		board[i][j] = a[j]
yes = 1
centery = 0
for i in range(1, h - 1):
	count = 0
	for j in range(w):
		if board[i][j] == '*':
			count += 1
	if count > 2:
		centery = i
		break
if centery == 0:
	yes = 0
elif '*' not in board[centery - 1]:
	yes = 0
else:
	centerx = board[centery - 1].index('*')
	if board[centery][centerx] == '.':
		yes = 0
	else:
		everything = [i for i in range(h * w)]
		everything.remove(centerx + centery * w)
		pos = centery - 1
		while board[pos][centerx] == '*':
			everything.remove(centerx + pos * w)
			pos -= 1
			if pos < 0:
				break
		pos = centery + 1
		if board[pos][centerx] != '*':
			yes = 0
		else:
			while board[pos][centerx] == '*':
				everything.remove(centerx + pos * w)
				pos += 1
				if pos >= h:
					break
			pos = centerx - 1
			if board[centery][pos] != '*':
				yes = 0
			else:
				while board[centery][pos] == '*':
					everything.remove(pos + centery * w)
					pos -= 1
					if pos < 0:
						break
				pos = centerx + 1
				if board[centery][pos] != '*':
					yes = 0
				else:
					while board[centery][pos] == '*':
						everything.remove(pos + centery * w)
						pos += 1
						if pos >= w:
							break
					for i in everything:
						if board[i // w][i % w] == '*':
							yes = 0
if yes == 0:
	print('NO')
else:
	print('YES')


(h, w) = map(int, input().split())
a = []
s = 0
for i in range(1, h + 1):
	a.append([*input()])
	s += a[-1].count('*')
ans = 'NO'
if s <= h + w - 1:
	for i in range(1, h - 1):
		for j in range(1, w - 1):
			if a[i][j] == '*':
				u = l = r = d = 0
				k = j - 1
				while k >= 0 and a[i][k] == '*':
					l += 1
					k -= 1
				k = j + 1
				while k < w and a[i][k] == '*':
					r += 1
					k += 1
				k = i - 1
				while k >= 0 and a[k][j] == '*':
					u += 1
					k -= 1
				k = i + 1
				while k < h and a[k][j] == '*':
					d += 1
					k += 1
				if u and l and d and r and (u + l + d + r + 1 == s):
					ans = 'YES'
					break
		if ans == 'YES':
			break
print(ans)


import sys
(h, w) = map(int, input().split())
if h < 3 or w < 3:
	print('no')
	sys.exit(0)
first = True
emp = False
premp = False
cres = False
j = 0
for i in range(h):
	s = input()
	if '*' in s:
		if s.count('*') == 1 and (not premp):
			if j != 0:
				if j != s.index('*'):
					print('no')
					sys.exit(0)
			j = s.index('*')
			continue
		elif first:
			first = False
			if i != h - 1:
				c = 0
				count = s.count('*')
				try:
					cr = s[j] == '*' and s[j + 1] == '*' and (s[j - 1] == '*')
				except ValueError:
					print('no')
					sys.exit(0)
				if count >= 3 and cr:
					for l in range(s.index('*'), w):
						if s[l] == '*':
							c += 1
						else:
							break
					if c != count:
						print('no')
						sys.exit(0)
				else:
					print('no')
					sys.exit(0)
			else:
				print('no')
				sys.exit(0)
			premp = True
		else:
			if s.count('*') != 1 or s.index('*') != j or emp:
				print('no')
				sys.exit(0)
			cres = True
	elif premp:
		emp = True
	elif j != 0:
		print('no')
		sys.exit(0)
print('yes' if cres else 'no')


(h, w) = map(int, input().split())
inpL = []
isTrue = False
for z in range(h):
	inpL.append(list(str(input())))
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if inpL[i][j] == '*':
			if inpL[i + 1][j] == '*':
				if inpL[i - 1][j] == '*':
					if inpL[i][j + 1] == '*':
						if inpL[i][j - 1] == '*':
							isTrue = True
							x = i + 0
							while x >= 0:
								if inpL[x][j] == '*':
									inpL[x][j] = '.'
								else:
									break
								x -= 1
							x = i + 1
							while x < h:
								if inpL[x][j] == '*':
									inpL[x][j] = '.'
								else:
									break
								x += 1
							y = j - 1
							while y >= 0:
								if inpL[i][y] == '*':
									inpL[i][y] = '.'
								else:
									break
								y -= 1
							y = j + 1
							while y < w:
								if inpL[i][y] == '*':
									inpL[i][y] = '.'
								else:
									break
								y += 1
							break
	if isTrue:
		break
if isTrue:
	isTrue = True
	for i in range(h):
		if '*' in inpL[i]:
			isTrue = False
			break
	if isTrue:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import sys
sys.setrecursionlimit(10 ** 9)

def dfs(i, j, lst):
	used[i][j] = True
	if mp[i][j] == '*':
		flags[i][j] = 1
	if i > 0 and (not used[i - 1][j]) and (lst[0] > 0) and (mp[i - 1][j] == '*'):
		dfs(i - 1, j, [1, 0, 0, 0])
	if i + 1 < n and (not used[i + 1][j]) and (lst[1] > 0) and (mp[i + 1][j] == '*'):
		dfs(i + 1, j, [0, 1, 0, 0])
	if j > 0 and (not used[i][j - 1]) and (lst[2] > 0) and (mp[i][j - 1] == '*'):
		dfs(i, j - 1, [0, 0, 1, 0])
	if j + 1 < m and (not used[i][j + 1]) and (lst[3] > 0) and (mp[i][j + 1] == '*'):
		dfs(i, j + 1, [0, 0, 0, 1])
(n, m) = map(int, input().split())
mp = []
for i in range(n):
	mp.append(input())
flags = [[0] * m for i in range(n)]
used = [[False] * m for i in range(n)]
ans = 0
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if mp[i][j] == mp[i + 1][j] == mp[i - 1][j] == mp[i][j + 1] == mp[i][j - 1] == '*' and ans == 0:
			dfs(i, j, [1, 1, 1, 1])
			ans = 1
end = ans > 0
for i in range(n):
	for j in range(m):
		if flags[i][j] == 0 and mp[i][j] == '*':
			end = False
if end:
	print('YES')
else:
	print('NO')


(a, b) = input('').split()
h = int(a)
w = int(b)
dict = {}
e = 0
g = ''
n = 502
f = 0
min = 501
max = -1
z = 0
y = True
for i in range(h):
	k = input('')
	if y:
		dict[i] = 0
		c = 0
		for j in range(w):
			if k[j] == '*':
				f += 1
				if c == 0:
					dict[i] = j
					u = j
					if i < min:
						min = i
					if i > max:
						max = i
				c += 1
				if c == 2:
					z += 1
					dict[i] = j
					start = u
					n = i
					g = k
		if c > 0:
			if c == 2:
				y = False
				break
			elif dict[i] == 0 or dict[i] == w - 1:
				y = False
				break
			if c > 2:
				if i == 0 and i == h - 1:
					y = False
					break
				else:
					r = c
					e += 1
				if e != 1:
					y = False
					break
		if i == n + 1 and i <= h - 1 and (i > 1):
			if dict[i] != dict[i - 2] or dict[i] == 0:
				y = False
				break
		if i != n and i - 1 >= min and (i <= max) and (i != n + 1):
			if dict[i - 1] != dict[i]:
				y = False
				break
for i in range(i + 1, h):
	k = input('')
if y:
	if f == 0 or f == w * h or z == 0:
		print('NO')
		exit()
	for p in range(w - 1, 0, -1):
		if g and g[p] == '*':
			end = p
			break
	if start != dict[n] - 1 or end != dict[n] - 2 + r:
		y = False
		print('NO')
	elif u <= start or u >= end:
		y = False
		print('NO')
	elif min == n or max == n:
		y = False
		print('NO')
	else:
		print('YES')
else:
	print('NO')


(a, b) = map(int, input().split())
l = []
for i in range(a):
	l.append(list(input()))
k = 0
count = 0

def checkstar(l, p, q):
	if p == 0 or q == 0 or p == a - 1 or (q == b - 1):
		return 0
	elif l[p + 1][q] == '*' and l[p][q + 1] == '*' and (l[p - 1][q] == '*') and (l[p][q - 1] == '*'):
		i = p
		while i >= 0:
			l[i][q] = '.'
			if i > 0 and l[i - 1][q] == '.':
				break
			i -= 1
		i = p
		while i < a:
			l[i][q] = '.'
			if i < a - 1 and l[i + 1][q] == '.':
				break
			i += 1
		i = q
		while i >= 0:
			l[p][i] = '.'
			if i > 0 and l[p][i - 1] == '.':
				break
			i -= 1
		i = q
		while i < b:
			l[p][i] = '.'
			if i < b - 1 and l[p][i + 1] == '.':
				break
			i += 1
		return 1
	return 0
for i in range(a):
	for j in range(b):
		if l[i][j] == '*':
			if checkstar(l, i, j):
				count += 1
				break
	if count == 1:
		break
if count == 1:
	for i in l:
		if '*' in i:
			k = 1
	if k:
		print('NO')
	else:
		print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
arr = [input() for _ in range(h)]
cnt_center = 0
pos_center_x = 0
pos_center_y = 0
cnt_plus = 1
cnt_black = 0
if h >= 3 and w >= 3:
	for i in range(1, h - 1):
		for j in range(1, w - 1):
			if arr[i][j] == '*':
				if arr[i - 1][j] == '*' and arr[i + 1][j] == '*' and (arr[i][j - 1] == '*') and (arr[i][j + 1] == '*'):
					cnt_center += 1
					pos_center_y = i
					pos_center_x = j
	if cnt_center != 1:
		print('NO')
	else:
		for i in range(pos_center_x - 1, -1, -1):
			if arr[pos_center_y][i] == '*':
				cnt_plus += 1
			else:
				break
		for i in range(pos_center_x + 1, w):
			if arr[pos_center_y][i] == '*':
				cnt_plus += 1
			else:
				break
		for i in range(pos_center_y - 1, -1, -1):
			if arr[i][pos_center_x] == '*':
				cnt_plus += 1
			else:
				break
		for i in range(pos_center_y + 1, h):
			if arr[i][pos_center_x] == '*':
				cnt_plus += 1
			else:
				break
		for i in range(h):
			for j in range(w):
				if arr[i][j] == '*':
					cnt_black += 1
		if cnt_plus == cnt_black:
			print('YES')
		else:
			print('NO')
else:
	print('NO')


import math, bisect, heapq
(n, m) = map(int, input().split())
b = ''
a = []
for i in range(n):
	x = input()
	b += x
	a.append(list(x))
count = b.count('*')
if count >= n + m:
	print('NO')
else:
	z = 0
	for i in range(n):
		for j in range(m):
			(l, r, u, d) = (0, 0, 0, 0)
			(x, y) = (i, j)
			c = 0
			cc = 0
			while a[x][y] == '*':
				c += 1
				y -= 1
				if y < 0:
					break
			if c <= 1:
				continue
			cc += c
			(x, y) = (i, j)
			c = 0
			while a[x][y] == '*':
				c += 1
				y += 1
				if y >= m:
					break
			if c <= 1:
				continue
			cc += c
			(x, y) = (i, j)
			c = 0
			while a[x][y] == '*':
				c += 1
				x -= 1
				if x < 0:
					break
			if c <= 1:
				continue
			cc += c
			(x, y) = (i, j)
			c = 0
			while a[x][y] == '*':
				c += 1
				x += 1
				if x >= n:
					break
			if c <= 1:
				continue
			cc += c
			if cc == count + 3:
				z = 1
				break
	if z == 1:
		print('YES')
	else:
		print('NO')


(h, w) = map(int, input().split())
P = []
P.append([''] * (w + 1))
for i in range(1, h + 1):
	P.append(list(input().strip()))
	P[i].insert(0, '')
k = 0
for i in range(2, h):
	for j in range(2, w):
		if P[i][j] == '*' and P[i - 1][j] == '*' and (P[i + 1][j] == '*') and (P[i][j - 1] == '*') and (P[i][j + 1] == '*'):
			P[i][j] = '.'
			k += 1
			if k > 1:
				break
			for p in range(i + 1, h + 1):
				if P[p][j] == '*':
					P[p][j] = '.'
				else:
					break
			for p in range(i - 1, -1, -1):
				if P[p][j] == '*':
					P[p][j] = '.'
				else:
					break
			for p in range(j + 1, w + 1):
				if P[i][p] == '*':
					P[i][p] = '.'
				else:
					break
			for p in range(j - 1, -1, -1):
				if P[i][p] == '*':
					P[i][p] = '.'
				else:
					break
	if k > 1:
		break
if k == 1:
	for i in range(1, h + 1):
		for j in range(1, w + 1):
			if P[i][j] == '*':
				k += 1
				break
print('YES' if k == 1 else 'NO')


(h, w) = map(int, input().split())
m = [list(input()) for i in range(h)]
res = False
for i in range(1, h - 1):
	if res:
		break
	for j in range(1, w - 1):
		if m[i][j] == '*' and m[i - 1][j] == '*' and (m[i + 1][j] == '*'):
			if m[i][j - 1] == '*' and m[i][j + 1] == '*':
				if not res:
					res = True
					m[i][j] = '.'
					(r, c) = (i - 1, j)
					while r >= 0 and m[r][c] == '*':
						m[r][c] = '.'
						r -= 1
					(r, c) = (i + 1, j)
					while r < h and m[r][c] == '*':
						m[r][c] = '.'
						r += 1
					(r, c) = (i, j - 1)
					while c >= 0 and m[r][c] == '*':
						m[r][c] = '.'
						c -= 1
					(r, c) = (i, j + 1)
					while c < w and m[r][c] == '*':
						m[r][c] = '.'
						c += 1
					break
if res:
	for i in range(h):
		if '*' in m[i]:
			res = False
			break
print('YES' if res else 'NO')


from sys import stdin, stdout

def valid(x, y):
	if a[x][y] != '*':
		return False
	for (xx, yy) in zip([1, -1, 0, 0], [0, 0, 1, -1]):
		if 0 <= x + xx < r and 0 <= y + yy < c and (a[x + xx][y + yy] == '*'):
			continue
		else:
			return False
	return True
for _ in range(1):
	(r, c) = list(map(int, stdin.readline().split()))
	a = [list(input()) for _ in range(r)]
	x = y = -1
	for i in range(r):
		for j in range(c):
			if valid(i, j):
				(x, y) = (i, j)
				break
	if x == -1:
		print('NO')
		continue
	a[x][y] = '.'
	d = x + 1
	while d < r and a[d][y] == '*':
		a[d][y] = '.'
		d += 1
	u = x - 1
	while u >= 0 and a[u][y] == '*':
		a[u][y] = '.'
		u -= 1
	l = y - 1
	while l >= 0 and a[x][l] == '*':
		a[x][l] = '.'
		l -= 1
	right = y + 1
	while right < c and a[x][right] == '*':
		a[x][right] = '.'
		right += 1
	f = 1
	for i in range(r):
		for j in range(c):
			if a[i][j] == '*':
				f = 0
				break
	print('YES' if f else 'NO')


(n, m) = map(int, input().split())
a = []
for _ in range(n):
	a.append(list(map(lambda x: 1 if x == '*' else 0, input())))
ct = 0
(fl, fl1) = (False, False)
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if a[i][j] == 1:
			if not fl:
				if a[i][j - 1] == 1 and a[i][j + 1] == 1 and (a[i + 1][j] == 1) and (a[i - 1][j] == 1):
					a[i][j] = 0
					(x, y) = (i - 1, j)
					while x > -1 and a[x][y]:
						a[x][y] = 0
						x -= 1
					(x, y) = (i + 1, j)
					while x < n and a[x][y]:
						a[x][y] = 0
						x += 1
					(x, y) = (i, j - 1)
					while y > -1 and a[x][y]:
						a[x][y] = 0
						y -= 1
					(x, y) = (i, j + 1)
					while y < m and a[x][y]:
						a[x][y] = 0
						y += 1
					fl = True
					break
	if fl:
		break
for i in range(n):
	for j in range(m):
		if a[i][j] == 1:
			fl1 = True
			break
if fl and (not fl1):
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
p = []
for i in range(n):
	p.append(input())
ci = None
cj = None
for i in range(n):
	if i == 0 or i == n - 1:
		continue
	if ci:
		break
	for j in range(m):
		if j == 0 or j == m - 1:
			continue
		if p[i][j] == '*' and p[i - 1][j] == '*' and (p[i + 1][j] == '*') and (p[i][j - 1] == '*') and (p[i][j + 1] == '*'):
			ci = i
			cj = j
			break
if not ci:
	print('NO')
else:
	flag = True
	for i in range(n):
		if not flag:
			break
		if i == ci:
			continue
		for j in range(m):
			if not flag:
				break
			if j == cj:
				continue
			if p[i][j] == '*':
				flag = False
	if not flag:
		print('NO')
	else:
		notx = False
		j = 0
		k = m - 1
		while p[ci][j] != '*':
			j += 1
		while p[ci][k] != '*':
			k -= 1
		for i in range(j, k + 1):
			if p[ci][i] == '.':
				notx = True
		if notx:
			print('NO')
		else:
			noty = False
			x = 0
			y = n - 1
			while p[x][cj] != '*':
				x += 1
			while p[y][cj] != '*':
				y -= 1
			for i in range(x, y + 1):
				if p[i][cj] == '.':
					noty = True
			if noty:
				print('NO')
			else:
				print('YES')


VALID_CELL = '*'
NULL_CELL = '.'
DIRECTIONS = [(-1, 0), (0, -1), (1, 0), (0, 1)]
(h, w) = map(int, input().strip().split())
map = []
for _ in range(h):
	map.append([c for c in input().strip()])

def is_center(map, i, j):
	if map[i][j] == map[i - 1][j] == map[i][j - 1] == map[i + 1][j] == map[i][j + 1] == VALID_CELL:
		return True
	return False
i = 1
center_point = None
while i < h - 1 and (not center_point):
	j = 1
	while j < w - 1 and (not center_point):
		if is_center(map, i, j):
			center_point = (i, j)
		j += 1
	i += 1
if not center_point:
	print('NO')
	quit()
for (x_dir, y_dir) in DIRECTIONS:
	(x, y) = center_point
	x += x_dir
	y += y_dir
	if map[x][y] == VALID_CELL:
		while 0 <= x < h and 0 <= y < w and (map[x][y] == VALID_CELL):
			map[x][y] = NULL_CELL
			x += x_dir
			y += y_dir
	else:
		print('NO')
		quit()
map[center_point[0]][center_point[1]] = NULL_CELL
for i in range(h):
	for j in range(w):
		if map[i][j] == VALID_CELL:
			print('NO')
			quit()
print('YES')


from collections import deque
import sys
sys.setrecursionlimit(5000)
(r, c) = list(map(int, input().rstrip().split()))
grid = []
for _ in range(r):
	grid.append([i for i in input().rstrip()])
not_found = True
plus_coord = {}
for i in range(r):
	for j in range(c):
		if not_found:
			if grid[i][j] == '*':
				try:
					T = grid[i - 1][j]
					B = grid[i + 1][j]
					L = grid[i][j - 1]
					R = grid[i][j + 1]
					if T == '*' and B == '*' and (L == '*') and (R == '*'):
						not_found = False
						plus_coord[i, j] = 1
						for a in range(i - 1, -1, -1):
							if grid[a][j] == '*':
								plus_coord[a, j] = 1
							else:
								break
						for a in range(i + 1, r):
							if grid[a][j] == '*':
								plus_coord[a, j] = 1
							else:
								break
						for a in range(j - 1, -1, -1):
							if grid[i][a] == '*':
								plus_coord[i, a] = 1
							else:
								break
						for a in range(j + 1, c):
							if grid[i][a] == '*':
								plus_coord[i, a] = 1
							else:
								break
						break
				except IndexError:
					continue
	if not not_found:
		break
if not_found:
	print('NO')
	exit()
other = False
for i in range(r):
	for j in range(c):
		if grid[i][j] == '*' and (i, j) not in plus_coord:
			other = True
			break
	if other:
		break
if other:
	print('NO')
else:
	print('YES')


(h, w) = map(int, input().split())
arr = [None] * h
for i in range(h):
	arr[i] = input()
	arr[i] = list(arr[i])
flag = 0
has = [[0 for i in range(w)] for j in range(h)]
for i in range(1, h - 1):
	for j in range(1, w - 1):
		if arr[i][j] == '*' and arr[i + 1][j] == '*' and (arr[i - 1][j] == '*') and (arr[i][j + 1] == '*') and (arr[i][j - 1] == '*') and (arr[i - 1][j - 1] != '*') and (arr[i + 1][j - 1] != '*') and (arr[i + 1][j + 1] != '*') and (arr[i - 1][j + 1] != '*'):
			for i1 in range(i, h):
				if arr[i1][j] == '*':
					has[i1][j] = 1
				else:
					break
			i1 = i
			while i1 >= 0:
				if arr[i1][j] == '*':
					has[i1][j] = 1
				else:
					break
				i1 -= 1
			for j1 in range(j, w):
				if arr[i][j1] == '*':
					has[i][j1] = 1
				else:
					break
			j1 = j
			while j1 >= 0:
				if arr[i][j1] == '*':
					has[i][j1] = 1
				else:
					break
				j1 -= 1
			flag = 1
			break
	if flag == 1:
		break
flag1 = 0
for i in range(h):
	for j in range(w):
		if arr[i][j] == '*' and has[i][j] != 1:
			flag1 = 1
			break
	if flag1 == 1:
		break
if flag == 1 and flag1 == 0:
	print('YES')
else:
	print('NO')


import math
from collections import Counter
(n, m) = map(int, input().split())
a = []
k = 0
for i in range(n):
	a += [list(input())]
for i in range(1, n - 1):
	for j in range(1, m - 1):
		if a[i][j] == '*' and a[i][j + 1] == '*' and (a[i + 1][j] == '*') and (a[i - 1][j] == '*') and (a[i][j - 1] == '*'):
			c = j + 1
			d = i + 1
			while c < m:
				if a[i][c] == '*':
					a[i][c] = '.'
				else:
					break
				c += 1
			c = j - 1
			while c > -1:
				if a[i][c] == '*':
					a[i][c] = '.'
				else:
					break
				c -= 1
			while d < n:
				if a[d][j] == '*':
					a[d][j] = '.'
				else:
					break
				d += 1
			d = i - 1
			while d > -1:
				if a[d][j] == '*':
					a[d][j] = '.'
				else:
					break
				d -= 1
			a[i][j] = '.'
			k = 1
			break
	if k == 1:
		break
e = n
f = m
for i in range(0, e):
	for j in range(0, f):
		if a[i][j] == '*':
			print('NO')
			exit()
if k == 1:
	print('YES')
else:
	print('NO')


def solution(h, w, p):
	for i in range(h - 1):
		for j in range(w - 1):
			if p[i][j] == '*':
				if '.' in (p[i - 1][j], p[i + 1][j], p[i][j - 1], p[i][j + 1]):
					continue
				minusx = plusx = i
				while minusx >= 0 and p[minusx][j] == '*':
					p[minusx][j] = '.'
					minusx -= 1
				plusx = plusx + 1
				while plusx <= h - 1 and p[plusx][j] == '*':
					p[plusx][j] = '.'
					plusx += 1
				minusy = plusy = j
				minusy = minusy - 1
				while minusy >= 0 and p[i][minusy] == '*':
					p[i][minusy] = '.'
					minusy -= 1
				plusy = plusy + 1
				while plusy <= w - 1 and p[i][plusy] == '*':
					p[i][plusy] = '.'
					plusy += 1
				return ['YES', 'NO']['*' in '\n'.join([''.join(i) for i in p])]
	return 'NO'
(h, w) = [int(_) for _ in input().split()]
p = []
for _ in range(h):
	p.append(list(input()))
print(solution(h, w, p))


from sys import stdin, stdout
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007

def solve():
	(n, m) = mp()
	mat = [st() for i in range(n)]
	star = 0
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '*':
				star += 1
	if star == 0 or star >= m + n:
		pr('NO')
		return
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '*':
				c = -1
				p = i
				flag = False
				while p >= 0 and mat[p][j] == '*':
					p -= 1
					flag = True
					c += 1
				p = i + 1
				if not flag:
					continue
				flag = False
				while p < n and mat[p][j] == '*':
					p += 1
					c += 1
					flag = True
				if not flag:
					continue
				flag = False
				p = j
				while p >= 0 and mat[i][p] == '*':
					p -= 1
					c += 1
					flag = True
				if not flag:
					continue
				p = j + 1
				flag = False
				while p < m and mat[i][p] == '*':
					p += 1
					flag = True
					c += 1
				if not flag:
					continue
				if c == star:
					pr('YES')
					return
	pr('NO')
for _ in range(1):
	solve()


(h, w) = map(int, input().split())
L = [['' for i in range(w)] for j in range(h)]
for j in range(h):
	L[j] = input()
M = [['' for m in range(w)] for n in range(h)]
x = y = -1
for i in range(1, h - 1):
	if x != -1:
		break
	for j in range(1, w - 1):
		if x != -1:
			break
		if L[i][j] == '*' and L[i - 1][j] == '*' and (L[i + 1][j] == '*') and (L[i][j - 1] == '*') and (L[i][j + 1] == '*'):
			x = i
			y = j
			M[i][j] = '*'
if x == -1:
	print('NO')
else:
	for k in range(y + 1, w):
		if L[x][k] == '.':
			break
		if L[x][k] == '*':
			M[x][k] = '*'
	for k in range(y - 1, -1, -1):
		if L[x][k] == '.':
			break
		if L[x][k] == '*':
			M[x][k] = '*'
	for k in range(x + 1, h):
		if L[k][y] == '.':
			break
		if L[k][y] == '*':
			M[k][y] = '*'
	for k in range(x - 1, -1, -1):
		if L[k][y] == '.':
			break
		if L[k][y] == '*':
			M[k][y] = '*'
	for i in range(h):
		for j in range(w):
			if M[i][j] == '':
				M[i][j] = '.'
	f = True
	for i in range(h):
		for j in range(w):
			if L[i][j] != M[i][j]:
				f = False
	if f:
		print('YES')
	else:
		print('NO')


import collections
(h, w) = map(int, input().split())
s = []
conv = {'.': 0, '*': 1}
for i in range(h):
	next_line = input()
	s.append([])
	for j in range(w):
		s[i].append(conv[next_line[j]])

def row_sum(i):
	global s
	return sum(s[i])

def col_sum(j):
	global s, h
	result = 0
	for i in range(h):
		result += s[i][j]
	return result
r_sums = collections.deque(map(row_sum, range(h)))
c_sums = collections.deque(map(col_sum, range(w)))

def f(sums):
	if len(sums) <= 2:
		return False
	elif sums[0] == 0:
		sums.popleft()
		return f(sums)
	elif sums[-1] == 0:
		sums.pop()
		return f(sums)
	else:
		flag = 0
		for element in sums:
			if element != 1:
				flag += 1
				peak = element
		if flag == 1 and peak >= 3 and (sums[0] == 1) and (sums[-1] == 1):
			x = len(sums) - 1
			y = peak - 1
			return (x, y)
		else:
			return False
fr = f(r_sums)
fc = f(c_sums)
if fr and fc and (fr[0] == fc[1]) and (fr[1] == fc[0]):
	print('YES')
else:
	print('NO')


(H, W) = map(int, input().split())
stars = set()
pic = []
for i in range(H):
	line = input().strip()
	for j in range(W):
		cell = line[j]
		if cell == '*':
			stars.add((i, j))
	pic.append(line)

def solve():
	if H < 3 or W < 3:
		return False
	center = None
	for i in range(1, H - 1):
		for j in range(1, W - 1):
			if pic[i][j] == '*' and pic[i - 1][j] == '*' and (pic[i + 1][j] == '*') and (pic[i][j - 1] == '*') and (pic[i][j + 1] == '*') and (pic[i - 1][j - 1] == '.') and (pic[i - 1][j + 1] == '.') and (pic[i + 1][j - 1] == '.') and (pic[i + 1][j + 1] == '.'):
				center = (i, j)
	if center is None:
		return False
	seen = set()
	seen.add(center)
	seen.add((center[0] + 1, center[1]))
	seen.add((center[0], center[1] - 1))
	seen.add((center[0] - 1, center[1]))
	seen.add((center[0], center[1] + 1))
	for i in range(center[0] - 2, -1, -1):
		if pic[i][center[1]] == '*' and (pic[i][center[1] + 1] == '*' or pic[i][center[1] - 1] == '*'):
			return False
		if pic[i][center[1]] == '.':
			break
		else:
			seen.add((i, center[1]))
	for i in range(center[0] + 2, H):
		if pic[i][center[1]] == '*' and (pic[i][center[1] + 1] == '*' or pic[i][center[1] - 1] == '*'):
			return False
		if pic[i][center[1]] == '.':
			break
		else:
			seen.add((i, center[1]))
	for j in range(center[1] - 2, -1, -1):
		if pic[center[0]][j] == '*' and (pic[center[0] + 1][j] == '*' or pic[center[0] - 1][j] == '*'):
			return False
		if pic[center[0]][j] == '.':
			break
		else:
			seen.add((center[0], j))
	for j in range(center[1] + 2, W):
		if pic[center[0]][j] == '*' and (pic[center[0] + 1][j] == '*' or pic[center[0] - 1][j] == '*'):
			return False
		if pic[center[0]][j] == '.':
			break
		else:
			seen.add((center[0], j))
	if len(stars.difference(seen)) > 0:
		return False
	return True
if solve():
	print('YES')
else:
	print('NO')


def printPic(h, l, picture):
	print(' -- Printing Picture --')
	for i in range(h):
		line = ''
		for j in range(l):
			line += picture[i][j]
		print(line)

def countCross(height, lenght, picture, coordinate, direction):
	(coordX, coordY) = coordinate
	(dirX, dirY) = direction
	coordX += dirX
	coordY += dirY
	count = 0
	while coordX < height and coordX >= 0 and (coordY < lenght) and (coordY >= 0):
		if picture[coordX][coordY] != '*':
			return count
		count += 1
		coordX += dirX
		coordY += dirY
	return count

def isCross(height, lenght, picture):
	total_filled = 0
	cross = []
	for i in range(height):
		for j in range(lenght):
			if picture[i][j] == '*':
				total_filled += 1
				if i > 0 and i < height - 1:
					if j > 0 and j < lenght - 1:
						if picture[i + 1][j] == '*' and picture[i - 1][j] == '*' and (picture[i][j + 1] == '*') and (picture[i][j - 1] == '*'):
							picture[i][j] = 'X'
							cross += [(i, j)]
							if len(cross) > 1:
								return False
	if len(cross) != 1:
		return False
	cross_size = 1
	cross_size += countCross(height, lenght, picture, cross[0], [+1, 0])
	cross_size += countCross(height, lenght, picture, cross[0], [-1, 0])
	cross_size += countCross(height, lenght, picture, cross[0], [0, +1])
	cross_size += countCross(height, lenght, picture, cross[0], [0, -1])
	if cross_size == total_filled:
		return True
	else:
		return False
(height, lenght) = tuple(map(int, input().split(' ')))
picture = []
for i in range(height):
	picture += [list(input())]
if isCross(height, lenght, picture):
	print('YES')
else:
	print('NO')


global k

def Index(e, index):
	if e.__contains__('*'):
		k = []
		a = e.index('*')
		for i in range(e.count('*')):
			b = e.index('*', a, len(e))
			k.append(b)
			a = b + 1
		index.append(k)
(h, w) = map(int, input().split())
l = []
t = 0
q = 0
count = []
index = []
dict = {}
for i in range(h):
	l.append(list(input()))
	count.append(l[-1].count('*'))
if h < 3 or w < 3:
	dict['ans'] = 'NO'
elif count.count(0) == len(count) or len(count) < 3:
	dict['ans'] = 'NO'
else:
	copy_count = count
	while count[0] == 0:
		count.remove(count[0])
	count.reverse()
	while count[0] == 0:
		count.remove(count[0])
	if len(count) < 3:
		dict['ans'] = 'NO'
	elif count.__contains__(0):
		dict['ans'] = 'NO'
	elif count[0] > 1 or count[-1] > 1:
		dict['ans'] = 'NO'
	else:
		count.sort()
		if count[-2] > 1:
			dict['ans'] = 'NO'
		elif max(copy_count) < 3:
			dict['ans'] = 'NO'
		else:
			for e in l:
				Index(e, index)
			save = index[0][0]
			for f in index:
				d = f.__contains__(save)
				if d:
					q = 2
				elif d == False:
					q = 0
					dict['ans'] = 'NO'
					break
			if q == 2:
				copy1 = []
				for e in index:
					copy1.append(len(e))
				max_index = copy1.index(max(copy1))
				g = index[max_index]
				for i in range(len(g) - 1):
					if g[i + 1] == g[i] + 1:
						t = 2
					else:
						dict['ans'] = 'NO'
						t = 0
						break
				if t == 2:
					print('YES')
if t == 0:
	print(dict['ans'])


import sys, heapq
from collections import deque, defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
DBG = True

def ddprint(x):
	if DBG:
		print(x)
(h, w) = inm()
s = []
for i in range(h):
	s.append(input())
xc = -1
xt = -1
for i in range(h):
	for j in range(w):
		if s[i][j] == '*':
			xc = j
			xt = i
			break
	if xc != -1:
		break
yc = -1
yl = -1
for j in range(w):
	for i in range(h):
		if s[i][j] == '*':
			yc = i
			yl = j
			break
	if yc != -1:
		break
if xc == 0 or xc == w - 1 or yc == 0 or (yc == h - 1) or (xt >= yc) or (yl >= xc):
	print('NO')
	exit(0)
ok = [[False] * w for i in range(h)]
xb = -1
for i in range(xt, h):
	if s[i][xc] == '*':
		ok[i][xc] = True
		xb = i
	else:
		break
if xb <= yc:
	print('NO')
	exit()
yr = -1
for j in range(yl, w):
	if s[yc][j] == '*':
		ok[yc][j] = True
		yr = j
	else:
		break
if yr <= xc:
	print('NO')
	exit()
for i in range(h):
	for j in range(w):
		if s[i][j] == '*' and (not ok[i][j]):
			print('NO')
			exit()
print('YES')


t = list(map(int, input().split()))
(h, w) = (t[0], t[1])
inp = []
v = []
row = []
(l, r) = (0, 0)
sl = 0
for i in range(h):
	t = input()
	inp.append(t)
	(l, r) = (w, w)
	for j in range(w):
		if t[j] == '*':
			l = j
			r = j
			break
	for j in range(l + 1, w):
		if t[j] == '*':
			r = j
	t = [l, r]
	v.append(t)
	if r - l >= 2:
		row.append(i)
sl = len(row)
kq = 0
hang = 0
cot = 0
if sl == 1:
	hang = row[0]
	l = v[hang][0]
	r = v[hang][1]
	for j in range(l + 1, r):
		if inp[hang][j] == '.':
			break
		if 0 < hang < h - 1 and inp[hang][j] == '*' and (inp[hang][j - 1] == '*') and (inp[hang][j + 1] == '*'):
			if inp[hang - 1][j] == '*' and inp[hang + 1][j] == '*':
				for k in range(j + 2, r):
					if inp[hang][k] == '.':
						kq = 2
						break
				if kq == 2:
					kq = 0
				else:
					cot = j
					kq = 1
					break
if kq == 1:
	for i in range(h):
		if i != hang:
			t = v[i][1] - v[i][0]
			if t > 0:
				kq = 0
				break
			elif t == 0:
				if v[i][1] != cot and v[i][1] != w:
					kq = 0
					break
				if v[i][1] == cot:
					if i < hang:
						if inp[i + 1][cot] != '*':
							kq = 0
							break
					if i > hang:
						if inp[i - 1][cot] != '*':
							kq = 0
							break
if kq == 1:
	print('YES')
else:
	print('NO')


(h, w) = [int(x) for x in input().split()]

def check_row(row):
	first_star = row.find('*')
	last_star = row.rfind('*')
	stars = row[first_star:last_star + 1]
	return stars.find('.') == -1 and len(stars) > 1

def check():
	matrix = []
	r = -1
	c = -1
	for i in range(h):
		row = input()
		count = row.count('*')
		if count > 0:
			index = row.find('*')
			if count == 1:
				if c == -1:
					c = index
				elif c != index:
					return False
			elif r != -1:
				return False
			else:
				r = i
				if not check_row(row):
					return False
		matrix.append(row)
	if r == 0 or r == h - 1 or c == 0 or (c == w - 1):
		return False
	else:
		steps = [(0, 0), (1, 0), (0, 1), (-1, 0), (0, -1)]
		for (s1, s2) in steps:
			if matrix[r + s1][c + s2] != '*':
				return False
		row = ''.join([x[c] for x in matrix])
		if not check_row(row):
			return False
	return True
print('YES' if check() else 'NO')


(n, m) = [int(i) for i in input().split()]
v = [0] * m
h = [0] * n
arr = [['.'] * m for i in range(n)]
for i in range(n):
	s = 0
	inpt = input()
	for j in range(len(inpt)):
		v[j] += inpt[j] == '*'
		h[i] += inpt[j] == '*'
		arr[i][j] = inpt[j]

def f1(a):
	c = 0
	prev = True
	for i in a:
		curr = i == 0
		c += curr != prev
		prev = curr
	return c < 3

def f2(a):
	c = 0
	for i in a:
		if i > 1:
			c += 1
	return c == 1

def f3(a):
	c = 0
	prev = False
	for i in a:
		if i == 0:
			continue
		curr = i == 1
		c += curr != prev
		prev = curr
	return c == 3

def f4(a):
	mx = 0
	for row in a:
		c = 0
		prev = False
		for i in row:
			curr = i == '*'
			c += curr != prev
			prev = curr
		if mx < c:
			mx = c
	for i in range(len(a[0])):
		c = 0
		prev = False
		for j in range(len(a)):
			curr = a[j][i] == '*'
			c += curr != prev
			prev = curr
		if mx < c:
			mx = c
	return mx < 3

def check(a):
	return f1(a) and max(a) > 2 and f2(a) and f3(a)
if check(v) and check(h) and f4(arr):
	print('YES')
else:
	print('NO')


(h, w) = map(int, input().split())
s = [[1 if c == '*' else 0 for c in input()] for i in range(h)]
x = -1
xn = 0
y = -1
yn = 0
f = 0
for i in range(h):
	sm = sum(s[i])
	if f == 0:
		if sm == 1:
			f = 1
		if sm > 1:
			f = -1
			break
	elif f == 1:
		if sm > 2:
			f = 2
			y = i
			yn = sm
		if sm == 0:
			f = -1
			break
	elif f == 2:
		if sm == 1:
			f = 3
		else:
			f = -1
			break
	elif f == 3:
		if sm == 0:
			f = 4
		elif sm > 1:
			f = -1
			break
	elif f == 4 and sm > 0:
		f = -1
		break
yf = f
f = 0
for i in range(w):
	sm = sum([s[j][i] for j in range(h)])
	if f == 0:
		if sm == 1:
			f = 1
		if sm > 1:
			f = -1
			break
	elif f == 1:
		if sm > 2:
			f = 2
			x = i
			xn = sm
		if sm == 0:
			f = -1
			break
	elif f == 2:
		if sm == 1:
			f = 3
		else:
			f = -1
			break
	elif f == 3:
		if sm == 0:
			f = 4
		if sm > 1:
			f = -1
			break
	elif f == 4 and sm > 0:
		f = -1
		break
xf = f
if xf > 2 and yf > 2:
	f = 0
	for i in range(h):
		c = s[i][x]
		if f == 0 and c > 0:
			f = 1
		elif f == 1 and c == 0:
			f = 2
		elif f == 2 and c > 0:
			f = -1
			break
	xf = 1 if f > 0 else 0
	f = 0
	for i in range(w):
		c = s[y][i]
		if f == 0 and c > 0:
			f = 1
		elif f == 1 and c == 0:
			f = 2
		elif f == 2 and c > 0:
			f = -1
			break
	yf = 1 if f > 0 else 0
else:
	xf = yf = 0
print('YES' if xf + yf == 2 else 'NO')