A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the left. Naturally, the semiknight cannot move beyond the limits of the chessboard.

Petya put two semiknights on a standard chessboard. Petya simultaneously moves with both semiknights. The squares are rather large, so after some move the semiknights can meet, that is, they can end up in the same square. After the meeting the semiknights can move on, so it is possible that they meet again. Petya wonders if there is such sequence of moves when the semiknights meet. Petya considers some squares bad. That is, they do not suit for the meeting. The semiknights can move through these squares but their meetings in these squares don't count.

Petya prepared multiple chess boards. Help Petya find out whether the semiknights can meet on some good square for each board.

Please see the test case analysis.


-----Input-----

The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed that matrix contains exactly 2 semiknights. The semiknight's squares are considered good for the meeting. The tests are separated by empty line.


-----Output-----

For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise.


-----Examples-----
Input
2
........
........
......#.
K..##..#
.......#
...##..#
......#.
K.......

........
........
..#.....
..#..#..
..####..
...##...
........
....K#K#

Output
YES
NO



-----Note-----

Consider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from square (8, 1) to square (6, 3). Then both semiknights go to (4, 5) but this square is bad, so they move together to square (2, 7).

On the second board the semiknights will never meet.

Difficulty: MEDIUM

Solutions:
t = int(input())
for k in range(t):
	r8 = range(8)
	a = [input() for i in r8]
	ij = [(i, j) for i in r8 for j in r8]
	(x, y) = ((i, j) for (i, j) in ij if a[i][j] == 'K')

	def s(p):
		d = [(p[0] - 2, p[1] - 2), (p[0] + 2, p[1] - 2), (p[0] - 2, p[1] + 2), (p[0] + 2, p[1] + 2)]
		return set(((i, j) for (i, j) in ij if (i, j) in d))
	print('YES' if len(s(x) & s(y)) > 0 else 'NO')
	if k != t - 1:
		input()


for i in range(int(input())):
	if i:
		input()
	ans = []
	for i in range(8):
		s = input()
		for j in range(8):
			if s[j] == 'K':
				ans.append((i, j))
	print(['NO', 'YES'][abs(ans[0][0] - ans[1][0]) % 4 == 0 and abs(ans[0][1] - ans[1][1]) % 4 == 0])


t = int(input())
for _ in range(t):
	s = [input() for i in range(8)]
	oh = True
	flag = True
	for i in range(8):
		for j in range(8):
			if s[i][j] == 'K':
				if flag:
					pos1x = i
					pos1y = j
					flag = False
				else:
					pos2x = i
					pos2y = j
	if pos1x % 4 == pos2x % 4 and pos1y % 4 == pos2y % 4:
		print('YES')
	else:
		print('NO')
	if _ < t - 1:
		k = input()


t = int(input())
for _ in range(t):
	if _:
		input()
	knights = []
	for i in range(8):
		s = input().strip()
		for j in range(8):
			if s[j] == 'K':
				knights.append((i, j))
	n1 = knights[0]
	n2 = knights[1]
	if n1[0] % 4 == n2[0] % 4 and n1[1] % 4 == n2[1] % 4:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	L = []
	for i in range(8):
		L.append(input())
	Moves1 = []
	Moves2 = []
	K = []
	for i in range(8):
		Moves1.append([-1] * 8)
		Moves2.append([-1] * 8)
		for j in range(8):
			if L[i][j] == 'K':
				K.append((i, j))
	Now = K[0]
	Explored = [(Now[0], Now[1], 0)]
	Moves1[Now[0]][Now[1]] = 0
	while len(Explored) != 0:
		x = Explored[0][0]
		y = Explored[0][1]
		p = Explored[0][2]
		Explored.pop(0)
		if x - 2 >= 0 and y - 2 >= 0:
			if Moves1[x - 2][y - 2] == -1:
				Moves1[x - 2][y - 2] = 1 - p
				Explored.append((x - 2, y - 2, 1 - p))
		if x + 2 < 8 and y - 2 >= 0:
			if Moves1[x + 2][y - 2] == -1:
				Moves1[x + 2][y - 2] = 1 - p
				Explored.append((x + 2, y - 2, 1 - p))
		if x - 2 >= 0 and y + 2 < 8:
			if Moves1[x - 2][y + 2] == -1:
				Moves1[x - 2][y + 2] = 1 - p
				Explored.append((x - 2, y + 2, 1 - p))
		if x + 2 < 8 and y + 2 < 8:
			if Moves1[x + 2][y + 2] == -1:
				Moves1[x + 2][y + 2] = 1 - p
				Explored.append((x + 2, y + 2, 1 - p))
	Now = K[1]
	Explored = [(Now[0], Now[1], 0)]
	Moves2[Now[0]][Now[1]] = 0
	while len(Explored) != 0:
		x = Explored[0][0]
		y = Explored[0][1]
		p = Explored[0][2]
		Explored.pop(0)
		if x - 2 >= 0 and y - 2 >= 0:
			if Moves2[x - 2][y - 2] == -1:
				Moves2[x - 2][y - 2] = 1 - p
				Explored.append((x - 2, y - 2, 1 - p))
		if x + 2 < 8 and y - 2 >= 0:
			if Moves2[x + 2][y - 2] == -1:
				Moves2[x + 2][y - 2] = 1 - p
				Explored.append((x + 2, y - 2, 1 - p))
		if x - 2 >= 0 and y + 2 < 8:
			if Moves2[x - 2][y + 2] == -1:
				Moves2[x - 2][y + 2] = 1 - p
				Explored.append((x - 2, y + 2, 1 - p))
		if x + 2 < 8 and y + 2 < 8:
			if Moves2[x + 2][y + 2] == -1:
				Moves2[x + 2][y + 2] = 1 - p
				Explored.append((x + 2, y + 2, 1 - p))
	valid = False
	for i in range(8):
		for j in range(8):
			if Moves1[i][j] != -1 and Moves1[i][j] == Moves2[i][j] and (L[i][j] != '#'):
				valid = True
	if valid:
		print('YES')
	else:
		print('NO')
	if t != T - 1:
		s = input()


3
n = int(input())
for _ in range(n):
	k = []
	b = []
	for i in range(8):
		s = input()
		for j in range(8):
			if s[j] == 'K':
				k.append((i, j))
	print('YES' if abs(k[0][0] - k[1][0]) % 4 == 0 and abs(k[0][1] - k[1][1]) % 4 == 0 else 'NO')
	if _ < n - 1:
		input()


t = int(input())
for _ in range(t):
	if _ != 0:
		tmp = input()
	pos = []
	n = 8
	g = []
	for i in range(n):
		g.append([i for i in input()])
	for i in range(n):
		for j in range(n):
			if g[i][j] == 'K':
				pos.append((i, j))
	ok = False
	for i in range(n):
		for j in range(n):
			if i % 2 == pos[0][0] % 2 and i % 2 == pos[1][0] % 2 and (j % 2 == pos[0][1] % 2) and (j % 2 == pos[1][1] % 2):
				dist1 = (i - pos[0][0], j - pos[0][1])
				dist2 = (i - pos[1][0], j - pos[1][1])
				if dist1[0] - dist2[0] % 4 == 0 and dist1[1] - dist2[1] % 4 == 0:
					ok = True
	print('YES' if ok else 'NO')


import collections
n = list(map(int, input().split()))[0]
di = ((2, 2), (-2, 2), (-2, -2), (2, -2))

def bfs(graph, x, y, tx, ty):
	vis = set()
	queue = collections.deque()
	queue.append((x, y))
	vis.add((x, y))
	dis = {}
	dis[x, y] = 0
	while queue:
		elem = queue.popleft()
		for direction in di:
			new_elem = (elem[0] + direction[0], elem[1] + direction[1])
			if new_elem[0] >= 0 and new_elem[1] >= 0 and (new_elem[0] < 8) and (new_elem[1] < 8):
				if new_elem not in vis:
					vis.add(new_elem)
					queue.append(new_elem)
					dis[new_elem] = dis[elem] + 1
	if (tx, ty) not in vis:
		return (False, 0)
	return (True, dis[tx, ty])
for cc in range(n):
	datamap = []
	for i in range(8):
		datamap.append(input())
	ans = []
	for i in range(len(datamap)):
		for j in range(len(datamap[i])):
			if datamap[i][j] == 'K':
				ans.append(i)
				ans.append(j)
	ans = bfs(datamap, ans[0], ans[1], ans[2], ans[3])
	if ans[0] and ans[1] % 2 == 0:
		print('YES')
	else:
		print('NO')
	if cc != n - 1:
		input()


t = int(input())
el = [[1, 2, 3, 4, 1, 2, 3, 4], [5, 6, 7, 8, 5, 6, 7, 8], [9, 10, 11, 12, 9, 10, 11, 12], [13, 14, 15, 16, 13, 14, 15, 16], [1, 2, 3, 4, 1, 2, 3, 4], [5, 6, 7, 8, 5, 6, 7, 8], [9, 10, 11, 12, 9, 10, 11, 12], [13, 14, 15, 16, 13, 14, 15, 16]]
for x in range(t):
	arr = [[] for i in range(8)]
	for i in range(8):
		s = input()
		for j in range(len(s)):
			arr[i].append(s[j])
	l = 0
	for i in range(8):
		for j in range(8):
			if l == 0:
				if arr[i][j] == 'K':
					k1 = el[i][j]
					l = 1
			elif arr[i][j] == 'K':
				k2 = el[i][j]
				break
	if k1 == k2:
		print('YES')
	else:
		print('NO')
	if x != t - 1:
		y = list(map(int, input().split()))


n = int(input())
for t in range(n):
	if t:
		input()
	board = [[c for c in input()] for i in range(8)]
	(k1, k2) = ((i, j) for i in range(8) for j in range(8) if board[i][j] == 'K')
	if (k1[0] - k2[0]) % 4 == 0 and (k1[1] - k2[1]) % 4 == 0:
		print('YES')
	else:
		print('NO')


def f():
	t = []
	for i in range(8):
		p = input()
		for j in range(8):
			if p[j] == 'K':
				t += [i, j]
	if t[2] - t[0] in (0, 4) and t[1] - t[3] in (-4, 0, 4):
		return 'YES'
	return 'NO'
for i in range(int(input()) - 1):
	print(f())
	input()
print(f())


def check(x, y):
	return 0 <= x < 8 and 0 <= y < 8

def dfs1(x, y, T=0):
	nonlocal first, used
	if not check(x, y) or used[x][y]:
		return
	used[x][y] = True
	first.add((x, y, T))
	for pair in ((2, 2), (2, -2), (-2, 2), (-2, -2)):
		dfs1(x + pair[0], y + pair[1], 1 - T)

def dfs2(x, y, T=0):
	nonlocal second, used
	if not check(x, y) or used[x][y]:
		return
	used[x][y] = True
	second.add((x, y, T))
	for pair in ((2, 2), (2, -2), (-2, 2), (-2, -2)):
		dfs2(x + pair[0], y + pair[1], 1 - T)
t = int(input())
for i in range(t):
	if i > 0:
		kuzma = input()
	board = [input() for i in range(8)]
	FoundFirst = False
	for i in range(8):
		for j in range(8):
			if board[i][j] == 'K':
				if not FoundFirst:
					First = (i, j)
					FoundFirst = True
				else:
					Second = (i, j)
	used = [[0 for i in range(8)] for j in range(8)]
	first = set()
	dfs1(First[0], First[1])
	used = [[0 for i in range(8)] for j in range(8)]
	second = set()
	dfs2(Second[0], Second[1])
	intersection = first & second
	IsOk = False
	for (x, y, t) in intersection:
		if board[x][y] != '#':
			print('YES')
			IsOk = True
			break
	if not IsOk:
		print('NO')
	board = []


t = int(input())
while t:
	t += -1
	l = []
	mp = []
	for i in range(8):
		tmp = list(input())
		l.append(tmp)
		mp.append([0] * 8)
	(i1, j1, i2, j2) = (-1, -1, -1, -1)
	for i in range(8):
		for j in range(8):
			if l[i][j] == 'K' and i1 == -1:
				(i1, j1) = (i, j)
			if l[i][j] == 'K':
				(i2, j2) = (i, j)
	if abs(i2 - i1) % 4 == 0 and abs(j2 - j1) % 4 == 0:
		print('YES')
	else:
		print('NO')
	if t != 0:
		input()


import sys
import math
import collections
import heapq
t = int(input())
for w in range(t):
	l = []
	for i in range(8):
		l1 = list(input())
		l.append(l1)
	(t1, t2) = ((), ())
	for i in range(8):
		for j in range(8):
			if l[i][j] == 'K':
				if t1 == ():
					t1 = (i, j)
				else:
					t2 = (i, j)
					break
		if t2 != ():
			break
	if (t1[0] - t2[0]) % 4 == 0 and (t1[1] - t2[1]) % 4 == 0:
		print('YES')
	else:
		print('NO')
	if w < t - 1:
		input()


N = int(input())
for i in range(N):
	if i > 0:
		input()
	Pos = []
	for i in range(8):
		S = input().strip()
		for j in range(8):
			if S[j] == 'K':
				Pos.append((i, j))
	(Dx, Dy) = (abs(Pos[0][0] - Pos[1][0]), abs(Pos[0][1] - Pos[1][1]))
	if (Dx == 0 or Dx == 4) and (Dy == 0 or Dy == 4):
		print('YES')
	else:
		print('NO')


def solve(m, x, y, w, z):
	for i in range(8):
		for j in range(8):
			if m[i][j]:
				(a, pa) = movePossible(x, y, i, j)
				(b, pb) = movePossible(w, z, i, j)
				if a and b and (pa == pb):
					return True
	return False

def movePossible(x, y, w, z):
	a = x - w
	b = y - z
	pos = False
	ka = a // 2
	kb = b // 2
	if a % 2 == 0 and b % 2 == 0 and ((ka + kb) % 2 == 0):
		pos = True
	return (pos, ka % 2)
t = int(input())
for _c in range(t):
	m = []
	primo = True
	for i in range(8):
		m.append([])
		s = input()
		k = 0
		for c in s:
			if c == '#':
				m[i].append(False)
			else:
				m[i].append(True)
			if c == 'K' and primo:
				x = i
				y = k
				primo = False
			if c == 'K' and (not primo):
				w = i
				z = k
			k += 1
	if solve(m, x, y, w, z):
		print('YES')
	else:
		print('NO')
	if _c != t - 1:
		m = input()