After a hard-working week Polycarp prefers to have fun. Polycarp's favorite entertainment is drawing snakes. He takes a rectangular checkered sheet of paper of size $n \times m$ (where $n$ is the number of rows, $m$ is the number of columns) and starts to draw snakes in cells.

Polycarp draws snakes with lowercase Latin letters. He always draws the first snake with the symbol 'a', the second snake with the symbol 'b', the third snake with the symbol 'c' and so on. All snakes have their own unique symbol. There are only $26$ letters in the Latin alphabet, Polycarp is very tired and he doesn't want to invent new symbols, so the total number of drawn snakes doesn't exceed $26$.

Since by the end of the week Polycarp is very tired, he draws snakes as straight lines without bends. So each snake is positioned either vertically or horizontally. Width of any snake equals $1$, i.e. each snake has size either $1 \times l$ or $l \times 1$, where $l$ is snake's length. Note that snakes can't bend.

When Polycarp draws a new snake, he can use already occupied cells for drawing the snake. In this situation, he draws the snake "over the top" and overwrites the previous value in the cell.

Recently when Polycarp was at work he found a checkered sheet of paper with Latin letters. He wants to know if it is possible to get this sheet of paper from an empty sheet by drawing some snakes according to the rules described above. If it is possible, he is interested in a way to draw snakes.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 10^5$) — the number of test cases to solve. Then $t$ test cases follow.

The first line of the test case description contains two integers $n$, $m$ ($1 \le n,m \le 2000$) — length and width of the checkered sheet of paper respectively.

Next $n$ lines of test case description contain $m$ symbols, which are responsible for the content of the corresponding cell on the sheet. It can be either lowercase Latin letter or symbol dot ('.'), which stands for an empty cell.

It is guaranteed that the total area of all sheets in one test doesn't exceed $4\cdot10^6$.


-----Output-----

Print the answer for each test case in the input.

In the first line of the output for a test case print YES if it is possible to draw snakes, so that you can get a sheet of paper from the input. If it is impossible, print NO.

If the answer to this question is positive, then print the way to draw snakes in the following format. In the next line print one integer $k$ ($0 \le k \le 26$) — number of snakes. Then print $k$ lines, in each line print four integers $r_{1,i}$, $c_{1,i}$, $r_{2,i}$ and $c_{2,i}$ — coordinates of extreme cells for the $i$-th snake ($1 \le r_{1,i}, r_{2,i} \le n$, $1 \le c_{1,i}, c_{2,i} \le m$). Snakes should be printed in order of their drawing. If there are multiple solutions, you are allowed to print any of them.

Note that Polycarp starts drawing of snakes with an empty sheet of paper.


-----Examples-----
Input
1
5 6
...a..
..bbb.
...a..
.cccc.
...a..

Output
YES
3
1 4 5 4
2 3 2 5
4 2 4 5

Input
3
3 3
...
...
...
4 4
..c.
adda
bbcb
....
3 5
..b..
aaaaa
..b..

Output
YES
0
YES
4
2 1 2 4
3 1 3 4
1 3 3 3
2 2 2 3
NO

Input
2
3 3
...
.a.
...
2 2
bb
cc

Output
YES
1
2 2 2 2
YES
3
1 1 1 2
1 1 1 2
2 1 2 2

Difficulty: HARD

Solutions:
import sys
input = sys.stdin.readline

def solve():
	(H, W) = map(int, input().split())
	G = [[ord(s) - 46 for s in input().strip()] for _ in range(H)]
	Gy = list(map(list, zip(*G)))
	k = 0
	St = [None] * 77
	for (h, G1) in enumerate(G, 1):
		k = max(k, max(G1))
		for (w, g) in enumerate(G1, 1):
			if not g:
				continue
			if St[g] is None:
				St[g] = (h, w)
			elif type(St[g]) == tuple:
				(h1, w1) = St[g]
				if h == h1:
					St[g] = h
				elif w == w1:
					St[g] = -w
				else:
					return False
			else:
				if St[g] == h or St[g] == -w:
					continue
				return False
	if k == 0:
		return []
	A = []
	for j in range(k, 50, -1):
		if St[j] is None:
			A.append(A[-1])
			continue
		if type(St[j]) == tuple:
			A.append(St[j] * 2)
			continue
		x = St[j]
		if x > 0:
			Gh = G[x - 1]
			p = None
			e = None
			for (ig, g) in enumerate(Gh):
				if g == j:
					p = ig
					break
			for (ig, g) in enumerate(Gh[::-1]):
				ig = W - 1 - ig
				if g == j:
					e = ig
					break
			for ig in range(p, e + 1):
				if Gh[ig] < j:
					return False
			A.append((x, p + 1, x, e + 1))
		else:
			Gw = Gy[-x - 1]
			p = None
			e = None
			for (ig, g) in enumerate(Gw):
				if g == j:
					p = ig
					break
			for (ig, g) in enumerate(Gw[::-1]):
				ig = H - 1 - ig
				if g == j:
					e = ig
					break
			for ig in range(p, e + 1):
				if Gw[ig] < j:
					return False
			A.append((p + 1, -x, e + 1, -x))
	return A[::-1]
T = int(input())
for _ in range(T):
	ans = solve()
	if ans is False:
		print('NO')
		continue
	print('YES')
	print(len(ans))
	for a in ans:
		print(*a)


import sys

def solve():
	(H, W) = map(int, sys.stdin.readline().split())
	G = [[ord(s) - 46 for s in sys.stdin.readline().strip()] for _ in range(H)]
	k = 0
	inf = 10 ** 9
	Stbw = [-inf] * 77
	Stsw = [inf] * 77
	Stbh = [-inf] * 77
	Stsh = [inf] * 77
	for (h, G1) in enumerate(G, 1):
		k = max(k, max(G1))
		for (w, g) in enumerate(G1, 1):
			if not g:
				continue
			Stbw[g] = max(Stbw[g], w)
			Stsw[g] = min(Stsw[g], w)
			Stbh[g] = max(Stbh[g], h)
			Stsh[g] = min(Stsh[g], h)
	if k == 0:
		return []
	A = []
	for j in range(k, 50, -1):
		if Stbw[j] == -inf and Stbh[j] == -inf:
			A.append(A[-1])
			continue
		bw = Stbw[j] == Stsw[j]
		bh = Stbh[j] == Stsh[j]
		if not bw and (not bh):
			return False
		if bw:
			w = Stbw[j] - 1
			for h in range(Stsh[j] - 1, Stbh[j]):
				if G[h][w] < j:
					return False
		elif bh:
			h = Stbh[j] - 1
			for w in range(Stsw[j] - 1, Stbw[j]):
				if G[h][w] < j:
					return False
		A.append((Stsh[j], Stsw[j], Stbh[j], Stbw[j]))
	return A[::-1]
T = int(input())
for _ in range(T):
	ans = solve()
	if ans is False:
		print('NO')
		continue
	print('YES')
	print(len(ans))
	for a in ans:
		print(*a)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(N, M) = map(int, input().split())
	mar = [-1] * 26
	mir = [2000] * 26
	mac = [-1] * 26
	mic = [2000] * 26
	X = [[-1 if a == '.' else ord(a) - 97 for a in input()] for i in range(N)]
	R = [[a + 1 for a in range(M)] for _ in range(N)]
	D = [[i + 1] * M for i in range(N)]
	ma = -1
	for i in range(N):
		for j in range(M):
			k = X[i][j]
			if k >= 0:
				mar[k] = max(mar[k], i)
				mir[k] = min(mir[k], i)
				mac[k] = max(mac[k], j)
				mic[k] = min(mic[k], j)
				ma = max(ma, k)
	f = 0
	ans = 1
	ANS = []
	for k in range(ma + 1)[::-1]:
		if f and mar[k] == -1 and (mir[k] == 2000):
			ANS.append(ANS[-1])
		elif mar[k] == mir[k]:
			r = mar[k]
			c = mic[k]
			while c <= mac[k]:
				if X[r][c] < k:
					ans = 0
					break
				c = R[r][c]
			else:
				ANS.append((r + 1, mic[k] + 1, r + 1, mac[k] + 1))
			R[r][mic[k]] = mac[k] + 1
			if ans == 0:
				break
			f = 1
		elif mac[k] == mic[k]:
			c = mac[k]
			r = mir[k]
			while r <= mar[k]:
				if X[r][c] < k:
					ans = 0
					break
				r = D[r][c]
			else:
				ANS.append((mir[k] + 1, c + 1, mar[k] + 1, c + 1))
			D[mir[k]][c] = mar[k] + 1
			if ans == 0:
				break
			f = 1
		else:
			ans = 0
			break
	if ans == 0:
		print('NO')
	else:
		print('YES')
		print(len(ANS))
		for a in ANS[::-1]:
			print(*a)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	minx = {}
	maxx = {}
	miny = {}
	maxy = {}
	matrix = []
	for i in range(n):
		matrix.append(list(input().strip()))
	for i in range(n):
		for j in range(m):
			if matrix[i][j] != '.':
				try:
					minx[matrix[i][j]] = min(minx[matrix[i][j]], j)
				except:
					minx[matrix[i][j]] = j
				try:
					maxx[matrix[i][j]] = max(maxx[matrix[i][j]], j)
				except:
					maxx[matrix[i][j]] = j
				try:
					miny[matrix[i][j]] = min(miny[matrix[i][j]], i)
				except:
					miny[matrix[i][j]] = i
				try:
					maxy[matrix[i][j]] = max(maxy[matrix[i][j]], i)
				except:
					maxy[matrix[i][j]] = i
	copy = []
	for i in range(n):
		copy.append([])
		for j in range(m):
			copy[-1].append('.')
	for char in range(ord('a'), ord('z') + 1):
		char = chr(char)
		try:
			if minx[char] == maxx[char]:
				c = minx[char]
				for r in range(miny[char], maxy[char] + 1):
					copy[r][c] = char
			else:
				r = miny[char]
				for c in range(minx[char], maxx[char] + 1):
					copy[r][c] = char
		except:
			pass
	if matrix == copy:
		print('YES')
		cnt = -1
		for char in range(ord('z'), ord('a') - 1, -1):
			char = chr(char)
			try:
				minx[char] += 0
				break
			except:
				pass
		else:
			cnt = 0
		if cnt != 0:
			cnt = ord(char) - ord('a') + 1
		print(cnt)
		ans = []
		for char in range(ord('a'), ord('a') + cnt):
			char = chr(char)
			try:
				ans.append((miny[char], minx[char], maxy[char], maxx[char]))
			except:
				pass
		i = 0
		for char in range(ord('a'), ord('a') + cnt):
			char = chr(char)
			print(ans[i][0] + 1, ans[i][1] + 1, ans[i][2] + 1, ans[i][3] + 1)
			try:
				minx[char] += 0
				i += 1
			except:
				pass
	else:
		print('NO')


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
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')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

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

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

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

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

	def __len__(self):
		return self._len

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

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

class SegmentTree:

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

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

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

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

	def __len__(self):
		return self._len

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

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

class Factorial:

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

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

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

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

class Combination:

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

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

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

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

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

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

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

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
				self.temp.count += 1
			if not val:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left
				self.temp.count += 1
		self.temp.data = pre_xor

	def query(self, xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = xor & 1 << i
			if not val:
				if self.temp.left and self.temp.left.count > 0:
					self.temp = self.temp.left
				elif self.temp.right:
					self.temp = self.temp.right
			elif self.temp.right and self.temp.right.count > 0:
				self.temp = self.temp.right
			elif self.temp.left:
				self.temp = self.temp.left
			self.temp.count -= 1
		return xor ^ self.temp.data
t = int(input())
for ik in range(t):
	(n, m) = map(int, input().split())
	l = []
	f = 0
	d = defaultdict(list)
	for i in range(n):
		l.append(input())
	for i in range(n):
		for j in range(m):
			d[l[i][j]].append((i, j))
	for i in d:
		d[i].sort()
	ans = [['.' for i in range(m)] for j in range(n)]
	w = []
	c = 0
	for i in range(97, 123):
		if len(d[chr(i)]) == 0:
			c += 1
			continue
		else:
			a = d[chr(i)][0]
			b = d[chr(i)][-1]
			for j in range(c + 1):
				w.append((a, b))
			c = 0
			if a[0] == b[0]:
				for j in range(a[1], b[1] + 1):
					ans[a[0]][j] = chr(i)
			else:
				for j in range(a[0], b[0] + 1):
					ans[j][a[1]] = chr(i)
	for i in range(n):
		for j in range(m):
			if ans[i][j] == l[i][j]:
				continue
			else:
				f = 1
				print('NO')
				break
		if f == 1:
			break
	if f == 0:
		print('YES')
		print(len(w))
		for i in range(len(w)):
			print(w[i][0][0] + 1, w[i][0][1] + 1, w[i][1][0] + 1, w[i][1][1] + 1)


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, groupby
import sys
import bisect
import string
import math
import time
import random

def S_():
	return input()

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

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

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

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

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, Directed=False, index=0):
	org_inp = []
	g = [[] for i in range(n)]
	for i in range(E):
		inp = LI()
		org_inp.append(inp)
		if index == 0:
			inp[0] -= 1
			inp[1] -= 1
		if len(inp) == 2:
			(a, b) = inp
			g[a].append(b)
			if not Directed:
				g[b].append(a)
		elif len(inp) == 3:
			(a, b, c) = inp
			aa = (inp[0], inp[2])
			bb = (inp[1], inp[2])
			g[a].append(bb)
			if not Directed:
				g[b].append(aa)
	return (g, org_inp)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10 ** 5)
input = lambda : sys.stdin.readline().rstrip()

def ran_input():
	import random
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)
show_flg = False
show_flg = True
ans = 0
t = I()
for _ in range(t):
	(h, w) = LI()
	ans = []
	t = []
	ng = False
	rs = [[inf, -inf] for i in range(26)]
	cs = [[inf, -inf] for i in range(26)]
	for i in range(h):
		s = input()
		t.append(s)
		for j in range(w):
			if s[j] != '.':
				k = ord(s[j]) - 97
				rs[k][0] = min(rs[k][0], i + 1)
				rs[k][1] = max(rs[k][1], i + 1)
				cs[k][0] = min(cs[k][0], j + 1)
				cs[k][1] = max(cs[k][1], j + 1)
	ll = -1
	for i in range(26):
		if rs[i][0] != inf:
			ll = i
	if ll == -1:
		print('YES')
		print(0)
		continue
	for i in range(ll + 1)[::-1]:
		if (rs[i][0] != inf and rs[i][0] != rs[i][1]) and (cs[i][0] != inf and cs[i][0] != cs[i][1]):
			ng = True
			break
		elif rs[i][0] == inf:
			ans.append(lsn)
		else:
			lsn = [rs[i][0], cs[i][0], rs[i][1], cs[i][1]]
			ans.append(lsn)
			for r in range(rs[i][0], rs[i][1] + 1):
				for c in range(cs[i][0], cs[i][1] + 1):
					if ord(t[r - 1][c - 1]) - 97 < i:
						ng = True
	if ng:
		print('NO')
		continue
	else:
		print('YES')
		print(len(ans))
		for i in ans[::-1]:
			print(*i)