Mihai has an $8 \times 8$ chessboard whose rows are numbered from $1$ to $8$ from top to bottom and whose columns are numbered from $1$ to $8$ from left to right.

Mihai has placed exactly one bishop on the chessboard. The bishop is not placed on the edges of the board. (In other words, the row and column of the bishop are between $2$ and $7$, inclusive.)

The bishop attacks in all directions diagonally, and there is no limit to the distance which the bishop can attack. Note that the cell on which the bishop is placed is also considered attacked.

An example of a bishop on a chessboard. The squares it attacks are marked in red.

Mihai has marked all squares the bishop attacks, but forgot where the bishop was! Help Mihai find the position of the bishop.


-----Input-----

The first line of the input contains a single integer $t$ ($1 \leq t \leq 36$) — the number of test cases. The description of test cases follows. There is an empty line before each test case.

Each test case consists of $8$ lines, each containing $8$ characters. Each of these characters is either '#' or '.', denoting a square under attack and a square not under attack, respectively.


-----Output-----

For each test case, output two integers $r$ and $c$ ($2 \leq r, c \leq 7$) — the row and column of the bishop.

The input is generated in such a way that there is always exactly one possible location of the bishop that is not on the edge of the board.


-----Examples-----

Input
3
.....#..
#...#...
.#.#....
..#.....
.#.#....
#...#...
.....#..
......#.
#.#.....
.#......
#.#.....
...#....
....#...
.....#..
......#.
.......#
.#.....#
..#...#.
...#.#..
....#...
...#.#..
..#...#.
.#.....#
#.......
Output
4 3
2 2
4 5


-----Note-----

The first test case is pictured in the statement. Since the bishop lies in the intersection row $4$ and column $3$, the correct output is 4 3.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
t = int(input())
while t > 0:
	_ = input()
	board = [input() for _ in range(8)]
	for r in range(1, 7):
		for c in range(1, 7):
			if board[r - 1][c - 1] == '#' and board[r - 1][c + 1] == '#' and (board[r + 1][c - 1] == '#') and (board[r + 1][c + 1] == '#'):
				print(r + 1, c + 1)
				break
	t -= 1


import collections
for _ in range(int(input())):
	n = input()
	a = []
	for i in range(8):
		s = input()
		a.append(s)
	ans = []
	for i in range(1, 7):
		for j in range(1, 7):
			if a[i - 1][j - 1] == '#' and a[i + 1][j - 1] == '#' and (a[i - 1][j + 1] == '#') and (a[i + 1][j + 1] == '#'):
				print(1 + i, 1 + j)


def solve(mat):
	for i in range(1, 7):
		for j in range(1, 7):
			if all((mat[x][y] == '#' for (x, y) in [(i, j), (i + 1, j + 1), (i - 1, j + 1), (i - 1, j - 1), (i + 1, j - 1)])):
				return (i + 1, j + 1)
T = int(input())
for _ in range(T):
	input()
	mat = [input() for _ in range(8)]
	print(' '.join(map(str, solve(mat))))


t = int(input())
for _ in range(t):
	input()
	ch = []
	for i in range(8):
		ch.append(input())
	(x, y) = (0, 0)
	for i in range(1, 7):
		for k in range(1, 7):
			if ch[i][k] == '#' and ch[i - 1][k - 1] == '#' and (ch[i + 1][k - 1] == '#') and (ch[i + 1][k + 1] == '#') and (ch[i - 1][k + 1] == '#'):
				x = i + 1
				y = k + 1
				break
	print(x, y)


def func():
	l = []
	input('')
	for i in range(8):
		l.append(input(''))
	for i in range(8):
		if l[i].count('#') == 2:
			break
	for j in range(i, 8):
		if l[j].count('#') == 1:
			x = j + 1
			y = l[j].index('#') + 1
			print(x, y)
			return
t = int(input())
for _ in range(t):
	func()


n = int(input())
for i in range(n):
	x = input()
	a = []
	for j in range(8):
		s = input()
		a.append(s)
	ans = [0, 0, 0, 0, 0, 0, 0, 0]
	for k in range(8):
		for j in range(8):
			if a[k][j] == '#':
				ans[k] += 1
	result = -1
	for k in range(1, 7):
		if ans[k] == 1 and ans[k - 1] == 2 and (ans[k + 1] == 2):
			result = k
			break
	for k in range(8):
		if a[result][k] == '#':
			print(result + 1, k + 1)


def answer():
	lt = []
	for i in range(8):
		txt = input()
		temp = list(txt)
		lt.append(temp)
	pre = None
	ans = None
	for i in range(8):
		count = 0
		for j in range(8):
			if lt[i][j] == '#':
				count += 1
				ans = j
		if count == 2:
			pre = 2
		if count == 1 and pre == 2:
			break
	print(i + 1, ans + 1)
t = int(input())
for test in range(t):
	useless = input()
	answer()


for _ in range(int(input())):
	emp = input()
	l1 = []
	l = []
	for i in range(8):
		l1 = input()
		l.append(l1)
	for i in range(1, 7):
		for j in range(1, 7):
			if l[i][j] == '#':
				if l[i + 1][j + 1] == '#' and l[i + 1][j - 1] == '#' and (l[i - 1][j - 1] == '#') and (l[i - 1][j + 1] == '#'):
					print(i + 1, j + 1)
					break


for t in range(int(input())):
	s = input()
	l = []
	for i in range(8):
		l.append(input())
	for i in range(1, 7):
		for j in range(1, 7):
			if l[i - 1][j - 1] == '#' and l[i - 1][j + 1] == '#' and (l[i + 1][j - 1] == '#') and (l[i + 1][j + 1] == '#'):
				print(i + 1, j + 1)
				break


for _ in range(int(input())):
	a = []
	x = input()
	for i in range(8):
		s = input()
		a.append(s)
	for i in range(1, 7):
		for j in range(1, 7):
			if a[i][j] == '#' and a[i - 1][j - 1] == '#' and (a[i - 1][j + 1] == '#') and (a[i + 1][j - 1] == '#') and (a[i + 1][j + 1] == '#'):
				print(i + 1, j + 1)
				break


t = int(input())
for x in range(t):
	blank = input()
	coor = []
	for y in range(8):
		line = list(input())
		for z in range(len(line)):
			if line[z] == '#':
				coor.append([y, z])
	for a in range(len(coor)):
		flag = 0
		for b in range(len(coor)):
			if a != b:
				diff1 = coor[a][0] - coor[b][0]
				diff2 = coor[a][1] - coor[b][1]
				if abs(diff1) != abs(diff2):
					break
				else:
					flag += 1
		if flag >= len(coor) - 1:
			print(coor[a][0] + 1, coor[a][1] + 1)
			break


t = int(input())
for _ in range(t):
	input()
	matrix = []
	l = []
	for _ in range(8):
		matrix.append(input())
	for i in range(8):
		for j in range(8):
			if matrix[i][j] == '#':
				l.append([i, j])
	for i in l:
		s = 1
		for j in l:
			(x1, y1) = (i[0], i[1])
			(x2, y2) = (j[0], j[1])
			if (x1 - x2) ** 2 == (y1 - y2) ** 2:
				pass
			else:
				s = 0
				break
		if s != 0:
			print(x1 + 1, y1 + 1)
			break


for t in range(int(input())):
	doska = []
	index = []
	for k in range(0, 9):
		s = input()
		doska.append(s)
		if s.count('#') == 1:
			index.append([k - 1, s.index('#')])
	doska = doska[1:]
	for i in index:
		if i[0] != 0 and i[0] != 7 and (i[1] != 0) and (i[1] != 7):
			if doska[i[0] - 1][i[1] - 1] == '#' and doska[i[0] - 1][i[1] + 1] == '#':
				print(str(i[0] + 1) + ' ' + str(i[1] + 1))
				break


ls = []
for i in range(int(input())):
	for j in range(9):
		s = input()
		if '#.#' in s:
			ls.append((j - 1, s.find('#.#') + 2))
for i in ls[1::2]:
	print(*i)


for i in range(int(input())):
	n = input()
	a = input()
	b = input()
	c = input()
	d = input()
	e = input()
	f = input()
	g = input()
	h = input()
	c1 = a.count('#')
	c2 = b.count('#')
	c3 = c.count('#')
	c4 = d.count('#')
	c5 = e.count('#')
	c6 = f.count('#')
	c7 = g.count('#')
	c8 = h.count('#')
	if c1 > c2:
		print('2 ' + str(b.index('#') + 1))
	elif c2 > c3:
		print('3 ' + str(c.index('#') + 1))
	elif c3 > c4:
		print('4 ' + str(d.index('#') + 1))
	elif c4 > c5:
		print('5 ' + str(e.index('#') + 1))
	elif c5 > c6:
		print('6 ' + str(f.index('#') + 1))
	elif c6 > c7:
		print('7 ' + str(g.index('#') + 1))


ans = []
for i in range(int(input())):
	test = []
	input()
	for i in range(8):
		test.append(list(input()))

	def safe(i, j, test):
		if test[i][j] == '#' and test[i - 1][j - 1] == '#' and (test[i - 1][j + 1] == '#') and (test[i + 1][j - 1] == '#') and (test[i + 1][j + 1] == '#'):
			return True
		return False
	t = False
	for i in range(1, 7):
		for j in range(1, 7):
			if safe(i, j, test):
				ans.append([i + 1, j + 1])
				break
		if t:
			break
for ele in ans:
	print(*ele)


t = int(input())
for _ in range(t):
	_ = input()
	two_before = False
	row = 0
	solved = False
	for _ in range(8):
		row += 1
		attack_fields = 0
		row_content = input()
		if solved:
			continue
		for letter in row_content:
			if letter == '#':
				attack_fields += 1
		if attack_fields == 2:
			two_before = True
		elif two_before:
			result = row_content.index('#') + 1
			print(str(row) + ' ' + str(result))
			solved = True
		else:
			two_before = False


for x in range(int(input())):
	i = input()
	board = []
	for x in range(8):
		l = [x for x in input()]
		board.append(l)
	ans = []
	for x in range(1, 7):
		for y in range(1, 7):
			if board[x][y] == '#' and board[x + 1][y + 1] == '#' and (board[x - 1][y - 1] == '#') and (board[x + 1][y - 1] == '#') and (board[x - 1][y + 1] == '#'):
				ans.append((x + 1, y + 1))
				break
	print(ans[-1][0], ans[-1][1])


for _ in range(int(input())):
	input()
	l = []
	for i in range(8):
		l += [input()]
	c = 'NO'
	for i in range(1, 7):
		for j in range(1, 7):
			if l[i][j] == '#':
				if l[i + 1][j - 1] == '#' and l[i + 1][j + 1] == '#' and (l[i - 1][j - 1] == '#') and (l[i - 1][j + 1] == '#'):
					c = 'YES'
					k = [i + 1, j + 1]
					break
		if c == 'YES':
			break
	print(*k)


def bishop():
	ls = []
	for i in range(8):
		ls.append(input())
	for i in range(1, 7):
		for j in range(1, 7):
			if ls[i][j] == '#':
				if ls[i - 1][j - 1] == '#' and ls[i + 1][j + 1] == '#' and (ls[i - 1][j + 1] == '#') and (ls[i + 1][j - 1] == '#'):
					return (i + 1, j + 1)
n = int(input())
for i in range(n):
	input()
	a = bishop()
	print(a[0], a[1])


t = int(input())
for _ in range(t):
	input()
	prev = 0
	k = 1
	for i in range(8):
		s = input()
		h = s.count('#')
		if prev == 2 and h == 1 and (k == 1):
			r = i
			c = s.index('#')
			k = 0
		prev = h
	print(r + 1, c + 1)


t = int(input())
for i in range(t):
	emp = input()
	lst = list()
	for j in range(8):
		line = input()
		lst.append(line)
	for j in range(1, 7):
		for k in range(1, 7):
			if (lst[j - 1][k - 1] == '#' and lst[j - 1][k + 1] == '#') and (lst[j + 1][k + 1] == '#' and lst[j + 1][k - 1] == '#'):
				print(j + 1, k + 1)
				break


for _ in range(int(input())):
	grid = []
	(r, c) = (0, 0)
	input()
	for i in range(8):
		grid.append(list(input()))
	for i in range(8):
		for j in range(8):
			if i - 1 >= 0 and j - 1 >= 0 and (i + 1 < 8) and (j + 1 < 8):
				if grid[i][j] == '#' and grid[i - 1][j - 1] == '#' and (grid[i + 1][j + 1] == '#') and (grid[i - 1][j + 1] == '#') and (grid[i + 1][j - 1] == '#'):
					print(i + 1, j + 1)
					break


tc = int(input())
for _ in range(tc):
	l = []
	input()
	for __ in range(8):
		l.append(input())
	for i in range(1, 7, 1):
		for j in range(1, 7, 1):
			if l[i][j] == '#':
				if l[i - 1][j - 1] == l[i - 1][j + 1] == l[i + 1][j - 1] == l[i + 1][j + 1] == '#':
					print(f'{i + 1} {j + 1}')
					break


for a0 in range(int(input())):
	l1 = []
	empty = input()
	for i in range(8):
		l = list(input())
		l1.append(l)
	for i in range(1, 7):
		if l1[i].count('#') == 1:
			x = l1[i].index('#')
			if x >= 1 and x <= 6:
				if l1[i - 1][x - 1] == l1[i - 1][x + 1] == l1[i + 1][x - 1] == l1[i + 1][x + 1]:
					print(i + 1, x + 1)
					break


t = int(input())
for t in range(t):
	grid = []
	for i in range(9):
		grid.append(input())
	grid.pop(0)
	hash1 = []
	for i in grid:
		hash1.append(i.count('#'))
	for (i, o) in enumerate(hash1):
		if o == 1 and (i != 0 and i != 7):
			if hash1[i - 1] == 2 and hash1[i + 1] == 2:
				print(i + 1, grid[i].index('#') + 1)


for _ in range(int(input())):
	t = input()
	a = []
	for i in range(8):
		a.append(str(input()))
	for i in range(1, 7):
		if a[i].count('#') == 1:
			for j in range(1, 7):
				if a[i][j] == '#':
					rj = j
			if a[i - 1][rj + 1] == '#' and a[i + 1][rj + 1] == '#':
				print(i + 1, rj + 1)


def count(s):
	ans = 0
	k = 0
	for i in range(8):
		if s[i] == '#':
			ans += 1
			if ans == 1:
				k = i
	return (ans, k)
t = int(input())
for i in range(t):
	input()
	arr = []
	for j in range(8):
		arr.append(input())
	for j in range(1, 7):
		(prev, k1) = count(arr[j - 1])
		(curr, k2) = count(arr[j])
		(next, k3) = count(arr[j + 1])
		if curr == 1 and prev == 2 and (next == 2):
			print(str(j + 1) + ' ' + str(k2 + 1))
			break


t = int(input())
out = []
for _ in range(t):
	board = []
	input()
	for _ in range(8):
		board.append(input())
	for i in range(1, 7):
		for j in range(1, 7):
			if board[i][j] == '#' and board[i + 1][j + 1] == '#' and (board[i + 1][j - 1] == '#') and (board[i - 1][j + 1] == '#') and (board[i - 1][j - 1] == '#'):
				out.append(f'{i + 1} {j + 1}')
				break
for o in out:
	print(o)


n = int(input())
input()
for _ in range(n):
	b = [input() for i in range(8)]
	if _ != n - 1:
		input()
	for i in range(1, 7):
		if b[i].count('#') == 1:
			f = b[i].index('#')
			if b[i - 1].count('#') == b[i + 1].count('#') == 2:
				print(i + 1, f + 1)
				break


for _ in range(int(input())):
	l = []
	for j in range(9):
		l.append(input())
	l.remove(l[0])
	a = []
	for i in range(len(l)):
		a.append(l[i].count('#'))
	for i in range(1, len(a) - 1):
		if a[i] == 1 and a[i - 1] == 2 and (a[i + 1] == 2):
			r = i + 1
	c = l[r - 1].index('#') + 1
	print(r, c)


n = int(input())
b = []
boards = []
for i in range(n * 9):
	l = input()
	if l == '':
		continue
	b.append(l)
	if i % 9 == 8:
		boards.append(b)
		b = []
for b in boards:
	for i in range(1, 7):
		for j in range(1, 7):
			if b[i][j] == '#':
				if b[i - 1][j - 1] == '#' and b[i + 1][j - 1] == '#' and (b[i - 1][j + 1] == '#') and (b[i + 1][j + 1] == '#'):
					print(i + 1, j + 1)


t = int(input())
for i in range(t):
	trash = input()
	board = [list(input()) for i in range(8)]
	for r in range(1, 7):
		if board[r].count('#') == 1 and board[r - 1].count('#') == 2 and (board[r + 1].count('#') == 2):
			print(r + 1, board[r].index('#') + 1)


for i in range(int(input())):
	desk = []
	flag = True
	t = list(input())
	for j in range(8):
		if t != []:
			for y in range(6):
				if t[y] == '#' == t[y + 2] and flag:
					print(j + 1, y + 2)
					flag = False
		t = list(input())


n = int(input())
for i in range(n):
	last = 0
	k = 0
	for j in range(0, 9):
		s = list(input())
		if k == 0:
			hash = s.count('#')
			if hash == 1 and last == 2:
				row = s.index('#')
				print(j, row + 1)
				k = 1
			else:
				last = hash


for _ in range(int(input())):
	matrix = []
	input()
	for i in range(8):
		arr = input()
		matrix.append(arr)
	l = []
	for i in range(8):
		l.append(matrix[i].count('#'))
	for i in range(1, 7):
		if l[i] == 1 and l[i - 1] == 2 and (l[i + 1] == 2):
			print(i + 1, matrix[i].index('#') + 1)
			break


t = int(input())
for i in range(t):
	m = []
	n = input()
	for k in range(8):
		x = input()
		m.append(x)
	for k in range(1, 7):
		for j in range(1, 7):
			if m[k - 1][j - 1] == '#' and m[k + 1][j - 1] == '#' and (m[k - 1][j + 1] == '#') and (m[k + 1][j + 1] == '#') and (m[k][j] == '#'):
				print(k + 1, j + 1)


t = int(input())
res = []
for i in range(t):
	input()
	a = [[''] * 8 for _ in range(8)]
	v = [[False] * 8 for _ in range(8)]
	r = 0
	for i in range(8):
		l = input()
		if i == 1:
			s_j = l.find('#')
		for j in range(8):
			a[r][j] = l[j]
		r += 1
	for i in range(1, 7):
		flag = False
		for j in range(1, 7):
			if a[i - 1][j - 1] == '#' and a[i - 1][j + 1] == '#' and (a[i][j] == '#') and (a[i + 1][j - 1] == '#') and (a[i + 1][j + 1] == '#'):
				res.append((i, j))
				flag = True
				break
		if flag:
			break
for i in range(t):
	print(res[i][0] + 1, res[i][1] + 1)


for _ in range(int(input())):
	arr = []
	for j in range(9):
		s = str(input())
		if s != '':
			arr.append(s)
	for i in range(1, len(arr) - 1):
		if arr[i].count('#') == 1 and arr[i + 1].count('#') == 2 and (arr[i - 1].count('#') == 2):
			print(i + 1, arr[i].find('#') + 1)
			break


for _ in range(int(input())):
	input()
	l = [input() for i in range(8)]
	i = 0
	while l[i].rfind('#') - l[i].find('#') != 2:
		i += 1
	print(i + 2, l[i].find('#') + 2)


exec(int(input()) * "k=-1\nfor i in range(9):\n if~(j:=input().find('#.#'))&k<0:k=j;print(i+1,j+2)\n")


def checker(arr):
	i = 0
	temp = []
	while i < len(arr):
		if arr[i] == '#':
			temp.append(i)
		i += 1
	if len(temp) == 2:
		if temp[1] - temp[0] == 2:
			return 1
	else:
		return 0
test_cases = int(input())
while test_cases != 0:
	input()
	m = []
	for t in range(0, 8):
		temp = input()
		m.append(temp)
	r = 0
	c = 0
	row = 1
	col = 1
	for y in m:
		if checker(y) == 1:
			r = row
			break
		row += 1
	for t2 in range(0, 8):
		temp = []
		for t3 in range(0, 8):
			temp.append(m[t3][t2])
		if checker(temp) == 1:
			c = col
			break
		col += 1
	print(r + 1, c + 1)
	test_cases -= 1


n = int(input())
for i in range(n):
	a = input()
	k = 0
	z = 0
	for j in range(8):
		s = input()
		l = s.count('#')
		if l == 1 and k == 2:
			z += 1
			if z == 1:
				x = j + 1
				y = s.find('#') + 1
		k = l
	print(x, y)


t = int(input())
for _ in range(t):
	input()
	flag = False
	l = []
	for i in range(8):
		l.append(input())
	for i in range(8):
		m = 0
		k = 0
		for j in range(8):
			if l[i][j] == '#':
				m += 1
				k = j
		if m == 2:
			flag = True
		if m == 1 and flag == True:
			print(i + 1, k + 1)
			break


n = int(input())
for w in range(n):
	a = []
	x = []
	u = input()
	for i in range(8):
		s = input()
		for l in s:
			x.append(l)
		a.append(x)
		x = []
	for i in range(1, 7):
		for j in range(1, 7):
			if a[i][j] == '#' and a[i - 1][j - 1] == '#' and (a[i - 1][j + 1] == '#') and (a[i + 1][j + 1] == '#') and (a[i + 1][j - 1] == '#'):
				print(i + 1, j + 1)


for _ in range(int(input())):
	input()
	f = [input() for i in range(8)]
	for i in range(1, 7):
		for j in range(1, 7):
			if f[i][j] == '#' and f[i - 1][j + 1] == '#' and (f[i - 1][j - 1] == '#') and (f[i + 1][j - 1] == '#') and (f[i + 1][j + 1] == '#'):
				print(i + 1, j + 1)
				break


def check(i, j, arr):
	try:
		if arr[i - 1][j - 1] == '#' and arr[i - 1][j + 1] == '#' and (arr[i + 1][j + 1] == '#') and (arr[i + 1][j - 1] == '#'):
			return True
	except:
		return False
	return False
t = int(input())
for _ in range(t):
	flag = 1
	arr = []
	x = input()
	for i in range(8):
		x = list(input())
		arr.append(x)
	for i in range(1, 7):
		for j in range(1, 7):
			if check(i, j, arr):
				print(i + 1, j + 1)
				flag = 0
				break
		if flag == 0:
			break


def ix(s):
	for item in s:
		if item == '#':
			p = s.index(item) + 1
			break
	return p
for _ in range(int(input())):
	(ans1, ans2) = (0, 0)
	(p, a, b, c, d, e, f, g, h) = (input(), input(), input(), input(), input(), input(), input(), input(), input())
	(a1, b1, c1, d1, e1, f1, g1, h1) = (a.count('#'), b.count('#'), c.count('#'), d.count('#'), e.count('#'), f.count('#'), g.count('#'), h.count('#'))
	if b1 == 1 and a1 + b1 + c1 == 5:
		(ans1, ans2) = (2, ix(b))
	elif c1 == 1 and b1 + c1 + d1 == 5:
		(ans1, ans2) = (3, ix(c))
	elif d1 == 1 and c1 + d1 + e1 == 5:
		(ans1, ans2) = (4, ix(d))
	elif e1 == 1 and d1 + e1 + f1 == 5:
		(ans1, ans2) = (5, ix(e))
	elif f1 == 1 and e1 + f1 + g1 == 5:
		(ans1, ans2) = (6, ix(f))
	elif g1 == 1 and f1 + g1 + h1 == 5:
		(ans1, ans2) = (7, ix(g))
	print(ans1, ans2)


for _ in range(int(input())):
	t = input()
	chess_board = []
	for i in range(8):
		n = list(input())
		chess_board.append(n)

	def check(chess_board):
		for r in range(8):
			for c in range(8):
				if chess_board[r][c] == '#':
					if r + 1 < 8 and c + 1 < 8 and (c - 1 > -1) and (r - 1 > -1) and (chess_board[r - 1][c - 1] == '#') and (chess_board[r + 1][c - 1] == '#') and (chess_board[r + 1][c + 1] == '#') and (chess_board[r - 1][c + 1] == '#'):
						return str(r + 1) + ' ' + str(c + 1)
	print(check(chess_board))


for _ in range(int(input())):
	input()
	t = []
	for i in range(8):
		t.append(input())
	for i in range(1, 7):
		c = 0
		for j in range(1, 7):
			if t[i][j] == '#' and t[i - 1][j - 1] == '#' and (t[i + 1][j + 1] == '#') and (t[i - 1][j + 1] == '#') and (t[i + 1][j - 1] == '#'):
				print(i + 1, j + 1)
				break


from collections import Counter
for i in range(int(input())):
	_ = input()
	board = [input() for _ in range(8)]
	for i in range(1, 7):
		for j in range(1, 7):
			if board[i][j] == '#' and board[i - 1][j - 1] == '#' and (board[i - 1][j + 1] == '#') and (board[i + 1][j - 1] == '#') and (board[i + 1][j + 1] == '#'):
				print(i + 1, j + 1)


for i in range(int(input())):
	a = input()
	arr = []
	for i in range(8):
		a = input()
		arr.append(a)
	l1 = []
	for i in arr:
		l1.append(i.count('#'))
	l2 = []
	for i in range(8):
		r = []
		for j in range(8):
			r.append(arr[j][i])
		l2.append(r.count('#'))
	l3 = ''
	for i in l1:
		l3 += str(i)
	l4 = ''
	for i in l2:
		l4 += str(i)
	print(l3.index('212') + 2, l4.index('21') + 2)


for t in range(int(input())):
	input()
	l = []
	for x in range(8):
		l.append(input())
	c = []
	for x in l:
		c.append(x.count('#'))
	i = 0
	for x in range(1, 7):
		if c[x] == 1 and c[x - 1] == c[x + 1] and (c[x - 1] == 2):
			i = x
	j = -1
	for x in l[i]:
		j += 1
		if x == '#':
			break
	print(i + 1, j + 1)


t = int(input())
for i in range(t):
	nothing = input()
	p = []
	for _ in range(8):
		string = input()
		p.append(string)
	for s in range(1, 7):
		if p[s].count('#') == 1 and p[s - 1].count('#') == 2 and (p[s + 1].count('#') == 2):
			x = s + 1
			break
	l = []
	for e in range(8):
		l.append(p[x - 1][-1:])
		p[x - 1] = p[x - 1][:-1]
	l = l[::-1]
	y = l.index('#') + 1
	print(x, y)


import re
t = int(input())
for _ in range(t):
	matriz = []
	for i in range(9):
		a = input()
		fila = list(a)
		if i != 0:
			matriz.append(fila)
	res = []
	resF = ()
	for i in range(8):
		c = 0
		for j in range(8):
			if matriz[i][j] == '#' and i > 0 and (i < 8) and (j > 0) and (j < 8):
				c += 1
				ubi = (i, j)
		if c == 1:
			k = ubi[0]
			m = ubi[1]
			if matriz[k - 1][m - 1] == '#' and matriz[k + 1][m + 1] == '#' and (matriz[k - 1][m + 1] == '#') and (matriz[k + 1][m - 1] == '#'):
				resF = (k, m)
				break
	print(resF[0] + 1, resF[1] + 1)


def solve(l):
	for i in range(1, 7):
		for j in range(1, 7):
			if l[i][j] == '#' and l[i + 1][j + 1] == '#' and (l[i - 1][j + 1] == '#') and (l[i - 1][j - 1] == '#') and (l[i + 1][j - 1] == '#'):
				print(f'{i + 1} {j + 1}')
				return
t = int(input())
for i in range(t):
	a = input()
	l = []
	for i in range(8):
		l.append(input())
	solve(l)


from ctypes import sizeof
n = int(input())
for j in range(n):
	input()
	flag = 0
	for i in range(8):
		s = input()
		if '#' not in s:
			continue
		cnt = 0
		for j in s:
			if j == '#':
				cnt = cnt + 1
		if cnt == 2:
			flag = 1
		if flag == 1 and cnt == 1:
			r = i + 1
			c = s.index('#') + 1
			for k in range(7 - i):
				input()
			break
	print(r, c)


for _ in range(int(input())):
	board = []
	for t in range(9):
		x = input()
		board.append(x)
	for i in range(1, 9):
		if '#.#' in board[i]:
			print(i + 1, board[i].index('#.#') + 2)
			break


t = int(input())
for __ in range(t):
	_ = input()
	for row in range(8):
		s = input()
		try:
			ans_col = s.index('#.#') + 2
			ans_row = row
		except ValueError:
			pass
	print(ans_row, ans_col)


t = int(input())
for q in range(t):
	mp = []
	empty = input()
	for w in range(8):
		s = [p for p in input()]
		mp.append(s)
	for i in range(1, 7):
		for j in range(1, 7):
			if mp[i][j] == '#' and mp[i - 1][j - 1] == '#' and (mp[i - 1][j + 1] == '#') and (mp[i + 1][j + 1] == '#') and (mp[i + 1][j - 1] == '#'):
				print(i + 1, j + 1)
				break


from itertools import chain
result = []
t = int(input())
for _ in range(t):
	input()
	chess = []
	for i in range(8):
		chess.append(input().strip())
	ans = ''
	for i in range(1, 7):
		for j in range(1, 7):
			if chess[i][j] == '#' == chess[i - 1][j - 1] == chess[i + 1][j + 1] == chess[i - 1][j + 1] == chess[i + 1][j - 1]:
				ans = (i + 1, j + 1)
	print(*ans)


for _ in range(int(input())):
	r = c = -1
	if False:
		print('Tanmay')
	s = input()
	a = []
	for i in range(8):
		a.append(input())
	for i in range(1, 7):
		for j in range(1, 7):
			if a[i - 1][j - 1] == '#' and a[i - 1][j + 1] == '#' and (a[i + 1][j - 1] == '#') and a[i + 1][j + 1]:
				r = i
				c = j
	print(r + 1, c + 1)


t = int(input())
for i in range(t):
	input()
	list1 = []
	for j in range(8):
		a = 0
		inp = input()
		list1.append(inp)
	for l in range(len(list1)):
		if list1[l].count('#') == 2:
			a = 1
		elif list1[l].count('#') == 1 and a == 1:
			print(l + 1, list1[l].index('#') + 1)
			break


for t in range(int(input())):
	b = input()
	col = []
	for i in range(8):
		str = input()
		if '#' in str:
			col.append(str.index('#'))
		else:
			col.append(9)
	for i in range(1, 7):
		if col[i] > col[i + 1] and col[i] > col[i - 1]:
			print(i + 1, col[i] + 1)
			break


t = int(input())
while t > 0:
	a = []
	empty = input()
	for i in range(8):
		a.append(str(input()))
	for i in range(1, 7):
		if a[i].count('#') == 1 and a[i - 1].count('#') == a[i + 1].count('#') == 2:
			r = i + 1
	c = 0
	for i in a[r - 1]:
		if i == '#':
			break
		else:
			c += 1
	print(r, c + 1)
	t -= 1


t = int(input())
fields = []
for i in range(t):
	empty = input()
	del empty
	field = []
	for j in range(8):
		a = input()
		field.append(a)
		del a
	fields.append(field)
for field in fields:
	for j in range(8):
		if j % 7 != 0:
			if field[j - 1].count('#') == field[j + 1].count('#') == 2 and field[j].count('#') == 1:
				print(j + 1, field[j].index('#') + 1)
				break


t = int(input())
for i in range(t):
	pust = input()
	count = 0
	check = False
	while count < 8:
		s = input()
		if check == False:
			for i in range(0, len(s) - 2):
				if s[i] == '#' and s[i + 2] == s[i]:
					r = count + 2
					c = i + 2
					check = True
					break
		count += 1
	print(r, c)


def checkTwo(directions):
	count = 0
	for direction in directions:
		new_i = i + direction[0]
		new_j = j + direction[1]
		if -1 < new_i < 8 and -1 < new_j < 8:
			if board[new_i][new_j] == '#':
				count += 1
	if count > 1:
		return (new_i, new_j)
	return False
answers = []
for _ in range(int(input())):
	input()
	mydict = dict()
	board = [list(input()) for i in range(8)]
	ans = 0
	for i in range(8):
		if ans != 0:
			break
		for j in range(8):
			if board[i][j] == '#':
				(countD, countU) = (checkTwo([(-1, 1), (-1, -1)]), checkTwo([(1, 1), (1, -1)]))
				(countR, countL) = (checkTwo([(-1, 1), (1, 1)]), checkTwo([(-1, -1), (1, -1)]))
				if countD or countU or countR or countL:
					ans = max(countD, countU, countR, countL)
					break
	answers.append(str(ans[0]) + ' ' + str(ans[1]))
for i in answers:
	print(i)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def check(board, i, j):
	if board[i + 1][j + 1] == '#' and board[i - 1][j - 1] == '#' and (board[i + 1][j - 1] == '#') and (board[i - 1][j + 1] == '#'):
		return True

def findBishop(board):
	position = []
	for i in range(1, 7):
		for j in range(1, 7):
			if board[i][j] == '#':
				if check(board, i, j):
					return [str(i + 1), str(j + 1)]
n = inp()
for _ in range(n):
	a = input().strip()
	board = []
	for i in range(8):
		board.append(input().strip())
	print(' '.join(findBishop(board)))


t = int(input())
for i in range(t):
	data = []
	for j in range(9):
		line = input()
		if line != '':
			data.append(line)
	ans = [0, 0]
	for z in range(len(data)):
		if '#.#' in data[z]:
			ans[0] = z + 2
			ans[1] = data[z + 1].index('#') + 1
			break
	print(ans[0], ans[1])


t = int(input())
for t1 in range(t):
	s = input()
	l = []
	for j in range(8):
		l.append(list(map(str, input().split())))
	ready = 0
	row = -1
	for k in l:
		row += 1
		if k[0].count('#') == 2:
			ready = 1
		elif k[0].count('#') == 1 and ready == 1:
			print(1 + row, 1 + k[0].index('#'))
			break


k = int(input())
for i in range(k):
	pole = []
	c_p = []
	k = 0
	for j in range(9):
		line = input()
		if line != '':
			pole.append(line)
			c_p.append(pole[k].count('#'))
			k = k + 1
	for j in range(1, 8, 1):
		if c_p[j] == 1:
			if c_p[j + 1] == 2 and c_p[j - 1] == 2:
				print(j + 1, pole[j].find('#') + 1)
				break


t = int(input())
for i in range(t):
	p = input()
	s = []
	m = [input() for i in range(8)]
	q = []
	for i in range(8):
		for j in range(8):
			q.append(m[i][j])
		s.append(q)
		q = []
	z = []
	for i in range(8):
		for j in range(8):
			if s[i][j] == '#':
				z.append([i, j])
	for i in range(len(z)):
		if [z[i][0] - 1, z[i][1] + 1] in z and [z[i][0] + 1, z[i][1] - 1] in z and ([z[i][0] - 1, z[i][1] - 1] in z) and ([z[i][0] + 1, z[i][1] + 1] in z):
			print(z[i][0] + 1, z[i][1] + 1)


import math
t = int(input())
for _ in range(t):
	dict = {}
	c = input()
	for i in range(1, 9):
		a = input()
		coun = a.count('#')
		dict[i] = coun
		if coun == 1:
			dict[i] = (a.index('#') + 1) ** 3
	b = list(dict.values())
	for i in range(len(b) - 2):
		if b[i] == 2 and b[i + 1] != 2 and (b[i + 2] == 2):
			print(i + 2, math.ceil(b[i + 1] ** (1 / 3)))
			break


from collections import defaultdict
t = int(input())
input()
for _ in range(t):
	mat = []
	for jk in range(8):
		mat.append(list(input()))
	di1 = defaultdict(set)
	di2 = defaultdict(set)
	for i in range(8):
		for j in range(8):
			if mat[i][j] == '#':
				di1[i - j].add((i, j))
				di2[i + j].add((i, j))
	key1 = list(sorted(di1.keys(), key=lambda k: -len(di1[k])))[0]
	key2 = list(sorted(di2.keys(), key=lambda k: -len(di2[k])))[0]
	(a, b) = list(di1[key1].intersection(di2[key2]))[0]
	print(f'{a + 1} {b + 1}')
	if _ != t - 1:
		input()


for i in range(int(input())):
	d = 0
	input()
	c = []
	for i in range(8):
		c.append(input())
	for k in range(8):
		if c[k].count('#') == 2:
			d = 1
		elif c[k].count('#') == 1 and d == 1:
			print(k + 1, c[k].index('#') + 1)
			break


for i in range(int(input())):
	input()
	r = 1
	row = []
	for l in range(8):
		row += [list(input())]
	d = []
	for ro in row:
		x = ro.count('#')
		d.append(x)
		if x == 1 and 2 in d:
			print(r, ro.index('#') + 1)
			break
		r += 1


t = int(input())
while t:
	l = []
	a = ''
	n = input()
	for i in range(8):
		a = input()
		l.append(a)
	for i in range(1, 8):
		if l[i].count('#') == 1:
			for a in range(1, 7):
				if l[i][a] == '#':
					if l[i - 1][a - 1] == '#' and l[i - 1][a + 1] == '#':
						print(i + 1, a + 1)
	t -= 1


t = int(input())
for i in range(t):
	l = []
	for j in range(9):
		l.append(list(input()))
	l.remove(l[0])
	ans = []
	for k in range(len(l)):
		ans.append(l[k].count('#'))
	r = 0
	for p in range(1, len(ans) - 1):
		if ans[p] == 1 and ans[p - 1] == 2 and (ans[p + 1] == 2):
			r = p + 1
			break
	print(r, end=' ')
	print(l[r - 1].index('#') + 1)


n = int(input())
input()
for i in range(0, n):
	board = []
	for j in range(0, 8):
		board.append(list(input()))
	for r in range(1, 7):
		for c in range(1, 7):
			if board[r - 1][c - 1] == '#' and board[r - 1][c + 1] == '#' and (board[r + 1][c - 1] == '#') and (board[r + 1][c + 1] == '#'):
				print(r + 1, c + 1)
	if i != n - 1:
		input()


def findBishop(m):
	for i in range(1, 7):
		for j in range(1, 7):
			if m[i][j] == '#' and m[i - 1][j - 1] == '#' and (m[i - 1][j + 1] == '#') and (m[i + 1][j - 1] == '#') and (m[i + 1][j + 1] == '#'):
				print(f'{i + 1} {j + 1}')
				return
n = int(input())
for _ in range(n):
	input()
	mtrx = [list(input()) for _ in range(8)]
	findBishop(mtrx)


def solution():
	l = []
	for i in range(9):
		a = list(map(str, input().split()))
		l.append(a)
	if [] in l:
		l.remove([])
	k = 0
	for i in range(8):
		cnt = 0
		p = 0
		for j in range(8):
			if l[i][0][j] == '#':
				cnt += 1
				p = j
		if cnt == 2:
			k = 1
		if cnt == 1 and k == 1:
			print(i + 1, p + 1)
			k = 3
			break
t = int(input())
for _ in range(t):
	solution()


t = int(input().split()[0])
while t:
	input()
	board = [0 for i in range(8)]
	for i in range(0, 8):
		board[i] = input()
	for i in range(1, 7):
		if board[i].count('#') == 1:
			if board[i - 1].count('#') == 2 and board[i + 1].count('#') == 2:
				print(f"{i + 1} {board[i].find('#') + 1}")
	t = t - 1


def bishop(board, p, q):
	if p == 0 or q == 0 or p == 7 or (q == 7):
		return False
	if board[p - 1][q + 1] == '#' and board[p - 1][q - 1] == '#' and (board[p + 1][q - 1] == '#') and (board[p + 1][q + 1] == '#'):
		return True
	return False

def findBishop(board):
	for i in range(8):
		for j in range(8):
			if board[i][j] == '#':
				if bishop(board, i, j):
					return (i + 1, j + 1)
tests = int(input())
for test in range(tests):
	board = []
	w = input()
	for i in range(8):
		board.append(list(input()))
	(r, c) = findBishop(board)
	print(r, c)


t = int(input())
for i in range(t):
	ls = []
	temp = input()
	for i in range(8):
		l = list(input())
		ls.append(l)
	for i in range(1, 7):
		for j in range(1, 7):
			if ls[i][j] == '#' and ls[i - 1][j - 1] == '#' and (ls[i - 1][j + 1] == '#') and (ls[i + 1][j - 1] == '#') and (ls[i + 1][j + 1] == '#'):
				print(i + 1, j + 1)
				break


import math

def lastIndexOf(str, value):
	str = str[::-1]
	i = str.index(value)
	str = str[::-1]
	return len(str) - i - 1
for _ in range(int(input())):
	ignore = input()
	doska = []
	col = 0
	row = 0
	check = True
	for i in range(8):
		a = input()
		doska.append(a)
		if a.count('#') > 1 and check:
			x = a.index('#')
			y = lastIndexOf(a, '#')
			num = lastIndexOf(a, '#') - a.index('#') - 1
			row = i + math.ceil(num / 2) + 1
			check = False
	col = doska[row - 1].index('#') + 1
	print(row, col)


T = int(input())
for tt in range(T):
	l = [[]]
	for x in range(9):
		a = input()
		a = str(a)
		l.append(a)
	c = -1
	for x in range(1, len(l)):
		if '#.#' in l[x]:
			c = x
			break
	c += 1
	indx = l[c].index('#')
	indx += 1
	print(c - 1, indx)


n = int(input())
for i in range(n):
	space = input()
	y = []
	r = 1
	for i in range(8):
		y += [input()]
	a = []
	for i in y:
		z = i.count('#')
		a.append(z)
		if z == 1 and 2 in a:
			print(r, i.index('#') + 1)
			break
		r += 1


t = int(input())
for _ in range(t):
	s = input()
	l = [input()]
	l.append(input())
	l.append(input())
	flag = False
	for j in range(3, 8):
		if not flag:
			for k in range(8):
				if l[j - 2][k] == '#':
					if k - 1 >= 0 and l[j - 3][k - 1] == '#' and (k + 1 < 8) and (l[j - 3][k + 1] == '#') and (l[j - 1][k - 1] == '#') and (l[j - 1][k + 1] == '#'):
						r = j - 1
						c = k + 1
						flag = True
		l.append(input())
	if not flag:
		for k in range(1, 7):
			if l[6][k] == '#':
				if l[5][k - 1] == '#' and l[5][k + 1] == '#' and (l[7][k - 1] == '#') and (l[7][k + 1] == '#'):
					r = 7
					c = k + 1
	print(r, c)


def T():
	return int(input())

def S():
	return str(input())

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

def M():
	return map(int, input().split(' '))
testCase = T()
for l in range(testCase):
	s = S()
	boardMatrix = []
	for i in range(8):
		s = S()
		boardMatrix.append(s)
	for i in range(1, 7):
		for j in range(1, 7):
			if boardMatrix[i][j] == '#':
				tl = boardMatrix[i - 1][j - 1]
				tr = boardMatrix[i - 1][j + 1]
				bl = boardMatrix[i + 1][j - 1]
				br = boardMatrix[i + 1][j + 1]
				if tl == tr == bl == br == '#':
					print(i + 1, j + 1)
					break


o = int(input())
a = input()
for i in range(o):
	arr = []
	for j in range(8):
		raw = list(input())
		for k in range(8):
			if raw[k] == '#':
				arr.append([j, k])
	m = 0
	n = 0
	for k in arr:
		try:
			if [k[0] - 1, k[1] - 1] in arr and [k[0] - 1, k[1] + 1] in arr:
				m = k[0]
				n = k[1]
				break
		except:
			pass
		try:
			if [k[0] - 1, k[1] + 1] in arr and [k[0] + 1, k[1] + 1] in arr:
				m = k[0]
				n = k[1]
				break
		except:
			pass
		try:
			if [k[0] + 1, k[1] + 1] in arr and [k[0] + 1, k[1] - 1] in arr:
				m = k[0]
				n = k[1]
				break
		except:
			pass
		try:
			if [k[0] + 1, k[1] - 1] in arr and [k[0] - 1, k[1] - 1] in arr:
				m = k[0]
				n = k[1]
				break
		except:
			pass
	print(m + 1, n + 1)
	if i == o - 1:
		exit(0)
	else:
		a = list(input())


t = int(input())
for i in range(t):
	x = input()
	l = []
	for i in range(8):
		l.extend([input()])
	for i in range(8):
		if l[i].count('#') == 2 and l[i + 1].count('#') == 1 and (l[i + 2].count('#') == 2):
			print(i + 2, l[i + 1].index('#') + 1)
			break


t = int(input())
for _ in range(t):
	l = []
	for i in range(9):
		l.append(input())
	l.remove(l[0])
	p = []
	for i in range(len(l)):
		p.append(l[i].count('#'))
	for i in range(1, len(p) - 1):
		if p[i] == 1 and p[i - 1] == 2 and (p[i + 1] == 2):
			r = i + 1
	c = l[r - 1].index('#') + 1
	print(r, c)


for k in range(int(input())):
	a = input()
	lst = []
	for i in range(8):
		lst.append(input())
	for j in range(1, 7):
		num = lst[j].count('#')
		if num == 1:
			a = lst[j].index('#')
			if lst[j - 1].count('#') == 2 and lst[j + 1].count('#') == 2:
				print(j + 1, a + 1, sep=' ', end='\n')
				break