Arkady is playing Battleship. The rules of this game aren't really important.

There is a field of $n \times n$ cells. There should be exactly one $k$-decker on the field, i. e. a ship that is $k$ cells long oriented either horizontally or vertically. However, Arkady doesn't know where it is located. For each cell Arkady knows if it is definitely empty or can contain a part of the ship.

Consider all possible locations of the ship. Find such a cell that belongs to the maximum possible number of different locations of the ship.


-----Input-----

The first line contains two integers $n$ and $k$ ($1 \le k \le n \le 100$) — the size of the field and the size of the ship.

The next $n$ lines contain the field. Each line contains $n$ characters, each of which is either '#' (denotes a definitely empty cell) or '.' (denotes a cell that can belong to the ship).


-----Output-----

Output two integers — the row and the column of a cell that belongs to the maximum possible number of different locations of the ship.

If there are multiple answers, output any of them. In particular, if no ship can be placed on the field, you can output any cell.


-----Examples-----
Input
4 3
#..#
#.#.
....
.###

Output
3 2

Input
10 4
#....##...
.#...#....
..#..#..#.
...#.#....
.#..##.#..
.....#...#
...#.##...
.#...#.#..
.....#..#.
...#.#...#

Output
6 1

Input
19 6
##..............###
#......#####.....##
.....#########.....
....###########....
...#############...
..###############..
.#################.
.#################.
.#################.
.#################.
#####....##....####
####............###
####............###
#####...####...####
.#####..####..#####
...###........###..
....###########....
.........##........
#.................#

Output
1 8



-----Note-----

The picture below shows the three possible locations of the ship that contain the cell $(3, 2)$ in the first sample. [Image]

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
(n, k) = [int(a) for a in input().split()]
field = []
for i in range(n):
	field.append(input())
poss = [[0] * n for _ in range(n)]
for i in range(n):
	for j in range(n - k + 1):
		good = True
		for ell in range(k):
			if field[j + ell][i] == '#':
				good = False
		if good:
			for ell in range(k):
				poss[j + ell][i] += 1
		good = True
		for ell in range(k):
			if field[i][j + ell] == '#':
				good = False
		if good:
			for ell in range(k):
				poss[i][j + ell] += 1
best = 0
besti = 0
bestj = 0
for i in range(n):
	for j in range(n):
		if best < poss[i][j]:
			best = poss[i][j]
			besti = i
			bestj = j
print(besti + 1, bestj + 1)


(n, k) = map(int, input().split())
field = []
for i in range(n):
	field.append(list(input()))

def cnt(x, y):
	if field[x][y] == '#':
		return 0
	hor = 0
	left = 0
	j = y - 1
	while j >= 0 and field[x][j] == '.':
		left += 1
		j -= 1
	right = 0
	j = y + 1
	while j < n and field[x][j] == '.':
		right += 1
		j += 1
	more = max(right, left)
	less = min(right, left)
	hor = min(less + 1 + more - k, less)
	if hor < 0:
		hor = 0
	else:
		hor += 1
	ver = 0
	up = 0
	i = x - 1
	while i >= 0 and field[i][y] == '.':
		up += 1
		i -= 1
	down = 0
	i = x + 1
	while i < n and field[i][y] == '.':
		down += 1
		i += 1
	more = max(down, up)
	less = min(down, up)
	ver = min(less + 1 + more - k, less)
	if ver < 0:
		ver = 0
	else:
		ver += 1
	return ver + hor
ans = 0
ansTuple = (0, 0)
for i in range(n):
	for j in range(n):
		count = cnt(i, j)
		if count > ans:
			ans = count
			ansTuple = (i, j)
print(str(ansTuple[0] + 1) + ' ' + str(ansTuple[1] + 1))


x = list(map(int, input().split()))
field = []
for i in range(x[0]):
	q = input()
	field.append([i for i in q])
points = [[0] * x[0] for i in range(x[0])]
checkerfield = []
checkerfieldtrans = []
ship = ['.'] * x[1]
for i in range(x[0]):
	for j in range(x[0]):
		checkerfield.append(field[i][j])
		checkerfieldtrans.append(field[j][i])
maxi = 0
maxiind = [0, 0]
for r in range(x[0]):
	for p in range(x[0] - x[1] + 1):
		fp = p + x[1]
		if checkerfield[p + r * x[0]:fp + r * x[0]] == ship:
			for i in range(x[1]):
				points[r][i + p] = points[r][i + p] + 1
				if points[r][i + p] >= maxi:
					maxi = points[r][i + p]
					maxiind = [r, i + p]
pointstrans = [[points[j][i] for j in range(x[0])] for i in range(x[0])]
for r in range(x[0]):
	for p in range(x[0] - x[1] + 1):
		fp = p + x[1]
		if checkerfieldtrans[p + r * x[0]:fp + r * x[0]] == ship:
			for i in range(x[1]):
				pointstrans[r][i + p] = pointstrans[r][i + p] + 1
				if pointstrans[r][i + p] >= maxi:
					maxi = pointstrans[r][i + p]
					maxiind = [i + p, r]
print(maxiind[0] + 1, maxiind[1] + 1)


def fill_segment(start_i, start_j, seg_len, direction, possible_map):
	if direction == 'right':
		for j in range(seg_len):
			possible_map[start_i][start_j + j]['left'] = j
			possible_map[start_i][start_j + j]['right'] = seg_len - j - 1
	elif direction == 'down':
		for i in range(seg_len):
			possible_map[start_i + i][start_j]['up'] = i
			possible_map[start_i + i][start_j]['down'] = seg_len - i - 1
	return possible_map

def get_possible_count(field, n):
	possible_map = list()
	for row in field:
		possible_map.append(list())
		for cell in row:
			possible_map[-1].append({'up': 0, 'down': 0, 'left': 0, 'right': 0})
	for i in range(len(field)):
		row = field[i]
		start = [i, -1]
		for j in range(len(row)):
			if row[j] == '#' and start[1] != -1:
				seg_len = j - start[1]
				possible_map = fill_segment(start[0], start[1], seg_len, 'right', possible_map)
				start = [i, -1]
			if row[j] == '.' and start[1] == -1:
				start = [i, j]
		if start[1] != -1:
			seg_len = len(row) - start[1]
			possible_map = fill_segment(start[0], start[1], seg_len, 'right', possible_map)
	for j in range(len(field[0])):
		start = [-1, j]
		for i in range(len(field)):
			if field[i][j] == '#' and start[0] != -1:
				seg_len = i - start[0]
				possible_map = fill_segment(start[0], start[1], seg_len, 'down', possible_map)
				start = [-1, j]
			if field[i][j] == '.' and start[0] == -1:
				start = [i, j]
		if start[0] != -1:
			seg_len = len(field) - start[0]
			possible_map = fill_segment(start[0], start[1], seg_len, 'down', possible_map)
	return possible_map

def count_ans(possible_map, k):
	ans = [1, 1]
	Max = 0
	for i in range(len(possible_map)):
		for j in range(len(possible_map[i])):
			cnt = possible_map[i][j]
			left = cnt['left']
			right = cnt['right']
			hor_variants = 0
			if left + right >= k - 1 and field[i][j] != '#':
				leftpos = k - min(right, k - 1)
				rightpos = min(left, k - 1) + 1
				hor_variants = rightpos - leftpos + 1
			up = cnt['up']
			down = cnt['down']
			ver_variants = 0
			if up + down >= k - 1 and field[i][j] != '#':
				uppos = k - min(down, k - 1)
				downpos = min(up, k - 1) + 1
				ver_variants = downpos - uppos + 1
			if hor_variants + ver_variants > Max:
				Max = hor_variants + ver_variants
				ans = [i + 1, j + 1]
	return ans
(n, k) = map(int, input().split())
field = list()
for _ in range(n):
	row = input()
	field.append(row)
possible_map = get_possible_count(field, n)
print(' '.join(map(str, count_ans(possible_map, k))))


def main():
	(n, k) = [int(x) for x in input().split()]
	board = []
	count = [[0 for i in range(n)] for j in range(n)]
	(m, x, y) = (0, 0, 0)
	for i in range(n):
		board.append(input())
	for i in range(n):
		for j in range(n):
			if board[i][j] == '.':
				if j + k - 1 < n and board[i][j + k - 1] == '.':
					for l in range(j, j + k):
						if board[i][l] == '#':
							break
					else:
						for l in range(j, j + k):
							count[i][l] += 1
				if i + k - 1 < n and board[i + k - 1][j] == '.':
					for l in range(i, i + k):
						if board[l][j] == '#':
							break
					else:
						for l in range(i, i + k):
							count[l][j] += 1
			if count[i][j] > m:
				m = count[i][j]
				(x, y) = (i, j)
	print(x + 1, y + 1)

def __starting_point():
	main()
__starting_point()


a = list(map(int, input().split()))
n = a[0]
k = a[1]
s = []
column = 1
row = 1
m = 0
for i in range(0, n):
	s.append(input())
for i in range(0, n):
	for j in range(0, n):
		if s[i][j] == '.':
			l = [0, 0, 0, 0]
			stop = [0, 0, 0, 0]
			spots = 0
			for q in range(1, min(k, j + 1)):
				if stop[0] == 0:
					if s[i][j - q] == '.':
						l[0] += 1
					else:
						stop[0] = 1
			for q in range(1, min(k, n - j)):
				if stop[1] == 0:
					if s[i][j + q] == '.':
						l[1] += 1
					else:
						stop[1] = 1
			for q in range(1, min(k, i + 1)):
				if stop[2] == 0:
					if s[i - q][j] == '.':
						l[2] += 1
					else:
						stop[2] = 1
			for q in range(1, min(k, n - i)):
				if stop[3] == 0:
					if s[i + q][j] == '.':
						l[3] += 1
					else:
						stop[3] = 1
			while l[0] + l[1] + 1 >= k and l[0] >= 0:
				spots += 1
				l[0] -= 1
			while l[2] + l[3] + 1 >= k and l[2] >= 0:
				spots += 1
				l[2] -= 1
			if spots > m:
				column = i + 1
				row = j + 1
				m = spots
print(column, row)


(n, k) = input().split()
(n, k) = (int(n), int(k))
data = []
for _ in range(n):
	data.append(input())
size_x = len(data[0])
counter = [[0 for _ in range(size_x)] for _ in range(n)]
for i in range(n):
	for j in range(size_x):
		if data[i][j] == '#':
			continue
		(vert, hor) = (True, True)
		if j + k > size_x:
			hor = False
		if i + k > n:
			vert = False
		for e in range(1, k):
			if vert:
				if data[i + e][j] == '#':
					vert = False
			if hor:
				if data[i][j + e] == '#':
					hor = False
			if not vert and (not hor):
				break
		if vert:
			for e in range(0, k):
				counter[i + e][j] += 1
		if hor:
			for e in range(0, k):
				counter[i][j + e] += 1
max_i = 0
max_j = 0
max_ = 0
for i in range(n):
	for j in range(size_x):
		if counter[i][j] > max_:
			(max_i, max_j) = (i, j)
			max_ = counter[i][j]
print(max_i + 1, ' ', max_j + 1)


(n, k) = list(map(int, input().split()))
my_map = []
for i in range(0, n):
	initial = list(input())
	line = []
	for it in initial:
		line += it
	my_map.append(line)
my_counter = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
	if len([it for it in my_map[i] if it == '.']) >= k:
		start = 0
		while start + k <= n:
			fit = True
			for j in range(start, start + k):
				if my_map[i][j] == '#':
					fit = False
					break
			if fit:
				for j in range(start, start + k):
					my_counter[i][j] += 1
			start += 1
rev = [['0' for i in range(n)] for j in range(n)]
for i in range(n):
	for j in range(n):
		rev[j][i] = my_map[i][j]
for i in range(n):
	if len([it for it in rev[i] if it == '.']) >= k:
		start = 0
		while start + k <= n:
			fit = True
			for j in range(start, start + k):
				if rev[i][j] == '#':
					fit = False
					break
			if fit:
				for j in range(start, start + k):
					my_counter[j][i] += 1
			start += 1
max_value = max(my_counter[0])
for line in my_counter:
	max_value = max(max_value, max(line))
if max_value == 0:
	print('1 1')
else:
	for i in range(n):
		for j in range(n):
			if my_counter[i][j] == max_value:
				print(i + 1, j + 1)
				exit()


(n, k) = map(int, input().split())
board = []
for _ in range(n):
	board.append(input())
result = [None] * n
for i in range(n):
	result[i] = [0] * n
for (r, row) in enumerate(board):
	for i in range(len(board) - k + 1):
		if row[i:i + k] == '.' * k:
			for x in range(i, i + k):
				result[r][x] += 1
for col in range(len(board)):
	for i in range(len(board) - k + 1):
		if ''.join([board[j][col] for j in range(i, i + k)]) == '.' * k:
			for x in range(i, i + k):
				result[x][col] += 1
_max = 0
max_pos = (0, 0)
for (r, row) in enumerate(result):
	for (c, col) in enumerate(row):
		if col > _max:
			max_pos = (r, c)
			_max = col
print('{} {}'.format(max_pos[0] + 1, max_pos[1] + 1))


(n, k) = list(map(int, input().strip().split()))
counts = [[0] * n for i in range(n)]
grids = []

def helper(arr, k):
	n = len(arr)
	(st, cur) = (0, 0)
	res = [0] * n
	while cur < n:
		if arr[cur] == '.':
			cur += 1
		else:
			length = cur - st
			if length >= k:
				mmax = min(length - k + 1, k)
				(i, j) = (st, cur - 1)
				cnt = 1
				while i <= j:
					res[i] = min(mmax, cnt)
					res[j] = min(mmax, cnt)
					cnt += 1
					i += 1
					j -= 1
			st = cur + 1
			cur = st
	if arr[cur - 1] == '.':
		length = cur - st
		if length >= k:
			mmax = min(length - k + 1, k)
			(i, j) = (st, cur - 1)
			cnt = 1
			while i <= j:
				res[i] = min(mmax, cnt)
				res[j] = min(mmax, cnt)
				cnt += 1
				i += 1
				j -= 1
	return res
for i in range(n):
	line = input().strip()
	grids.append(line)
	res = helper(line, k)
	for j in range(len(res)):
		counts[i][j] += res[j]
mmax = 0
(x, y) = (1, 1)
for i in range(n):
	line = []
	for j in range(n):
		line.append(grids[j][i])
	res = helper(line, k)
	for j in range(len(res)):
		counts[j][i] += res[j]
		if counts[j][i] > mmax:
			mmax = counts[j][i]
			(x, y) = (j + 1, i + 1)
print(x, y)


from sys import stdin
from math import ceil
(n, m) = map(int, stdin.readline().strip().split())
s = [list(stdin.readline().strip()) for i in range(n)]
acum1 = [[0 for i in range(n)] for j in range(n)]
ans = -1
x = -1
y = -1
for i in range(n):
	for j in range(n):
		acum = 0
		acum0 = 0
		acum1 = 0
		acum11 = 0
		for k in range(j, -1, -1):
			if s[i][k] == '#':
				break
			acum0 += 1
		for k in range(i, -1, -1):
			if s[k][j] == '#':
				break
			acum11 += 1
		acum0 -= 1
		acum11 -= 1
		ans1 = 0
		for k in range(j, n):
			if s[i][k] == '#':
				break
			if abs(k - j) < m and acum0 + abs(k - j) + 1 >= m:
				ans1 += 1
		for k in range(i, n):
			if s[k][j] == '#':
				break
			if abs(k - i) < m and acum11 + abs(k - i) + 1 >= m:
				ans1 += 1
		if ans1 > ans:
			x = i + 1
			y = j + 1
			ans = ans1
print(x, y)


(n, k) = map(int, list(input().split()))
all = [[None] for i in range(n)]
count = [[0] * n for i in range(n)]
ok = [[0] * n for i in range(n)]
for i in range(n):
	all[i] = list(input())
for i in range(n):
	for j in range(n):
		if all[i][j] == '.':
			count[i][j] = 1
			index_up = i
			index_down = i
			index_right = j
			index_left = j
			vert1 = 0
			vert2 = 0
			horiz1 = 0
			horiz2 = 0
			while index_right + 1 != n and all[i][index_right + 1] != '#':
				count[i][j] += 1
				index_right += 1
			vert1 = count[i][j] - 1
			count[i][j] = 1
			while index_left - 1 != -1 and all[i][index_left - 1] != '#':
				count[i][j] += 1
				index_left -= 1
			vert2 = count[i][j] - 1
			count[i][j] = 1
			while index_up - 1 != -1 and all[index_up - 1][j] != '#':
				count[i][j] += 1
				index_up -= 1
			horiz1 = count[i][j] - 1
			count[i][j] = 1
			while index_down + 1 != n and all[index_down + 1][j] != '#':
				count[i][j] += 1
				index_down += 1
			horiz2 = count[i][j] - 1
			count[i][j] = 1
			if vert1 > k - 1:
				vert1 = k - 1
			if vert2 > k - 1:
				vert2 = k - 1
			if horiz1 + 1 > k:
				horiz1 = k - 1
			if horiz2 + 1 > k:
				horiz2 = k - 1
			if vert1 + vert2 + 1 - k > -1:
				ok[i][j] += vert1 + vert2 + 2 - k
			if horiz1 + horiz2 + 1 - k > -1:
				ok[i][j] += horiz1 + horiz2 + 2 - k
maxs = [1] * 2
max_nw = 0
for i in range(n):
	if max(ok[i]) > max_nw:
		max_nw = max(ok[i])
		maxs[0] = i + 1
		maxs[1] = ok[i].index(max_nw) + 1
maxs = map(str, maxs)
print(' '.join(maxs))


from pprint import pprint
(N, K) = (int(i) for i in input().split())
field = []
count = [[0] * N for i in range(N)]
for i in range(N):
	field.append([c == '.' for c in input()])
for i in range(N):
	for j in range(N):
		if i + K <= N:
			if all((field[i + k][j] for k in range(K))):
				for k in range(K):
					count[i + k][j] += 1
		if K > 1 and j + K <= N:
			if all((field[i][j + k] for k in range(K))):
				for k in range(K):
					count[i][j + k] += 1
M = max((max(i) for i in count))
for i in range(N):
	for j in range(N):
		if count[i][j] == M:
			print(i + 1, j + 1)
			exit()
print(0, 0)


(n, k) = map(int, input().split())
L = []
for i in range(n):
	L.append(input())
ps1 = [[0] * (n + 1) for i in range(n)]
ps2 = [[0] * n for i in range(n + 1)]
for i in range(n):
	for j in range(n):
		ps1[i][j + 1] = ps1[i][j] + int(L[i][j] == '#')
		ps2[i + 1][j] = ps2[i][j] + int(L[i][j] == '#')
T = [[0] * n for i in range(n)]
for i in range(n):
	for j in range(n - k + 1):
		if ps1[i][j + k] - ps1[i][j] == 0:
			for x in range(k):
				T[i][j + x] += 1
for i in range(n - k + 1):
	for j in range(n):
		if ps2[i + k][j] - ps2[i][j] == 0:
			for x in range(k):
				T[i + x][j] += 1
(ans1, ans2) = (0, 0)
for i in range(n):
	for j in range(n):
		if T[i][j] > T[ans1][ans2]:
			(ans1, ans2) = (i, j)
print(ans1 + 1, ans2 + 1)


import math
(n, k) = map(int, input().split())
f = []
score = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
	f.append(input().strip())
for i in range(n):
	con = 0
	for j in range(n):
		if f[i][j] == '.':
			con += 1
		else:
			con = 0
		if con == k:
			con = k - 1
			for h in range(k):
				score[i][j - h] += 1
for i in range(n):
	con = 0
	for j in range(n):
		if f[j][i] == '.':
			con += 1
		else:
			con = 0
		if con == k:
			con = k - 1
			for h in range(k):
				score[j - h][i] += 1
ma = 0
row1 = 0
col1 = 0
for row in range(n):
	for col in range(n):
		if score[row][col] > ma:
			ma = score[row][col]
			row1 = row
			col1 = col
print(row1 + 1, col1 + 1)


(n, k) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
maxans = 0
xans = 0
yans = 0
for i in range(n):
	for j in range(n):
		curans = 0
		l = 0
		while l < k and i - l >= 0 and (a[i - l][j] == '.'):
			l += 1
		r = 0
		while r < k and i + r < n and (a[i + r][j] == '.'):
			r += 1
		curans += max(0, r + l - k)
		if k != 1:
			l = 0
			while l < k and j - l >= 0 and (a[i][j - l] == '.'):
				l += 1
			r = 0
			while r < k and j + r < n and (a[i][j + r] == '.'):
				r += 1
			curans += max(0, r + l - k)
		if curans > maxans:
			maxans = curans
			xans = i
			yans = j
print('{} {}'.format(xans + 1, yans + 1))


(n, k) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
maxans = 0
xans = 0
yans = 0
for i in range(n):
	for j in range(n):
		curans = 0
		up = 0
		while up < k and i - up >= 0 and (a[i - up][j] == '.'):
			up += 1
		down = 0
		while down < k and i + down < n and (a[i + down][j] == '.'):
			down += 1
		curans += max(0, down + up - k)
		if k != 1:
			left = 0
			while left < k and j - left >= 0 and (a[i][j - left] == '.'):
				left += 1
			right = 0
			while right < k and j + right < n and (a[i][j + right] == '.'):
				right += 1
			curans += max(0, right + left - k)
		if curans > maxans:
			maxans = curans
			xans = i
			yans = j
print(xans + 1, yans + 1)


def main():
	(n, k) = [int(x) for x in input().split()]
	s = []
	for x in range(n):
		s.append(list(input()))
	temp = [[0] * n for x in range(n)]
	for i in range(n):
		for j in range(n - k + 1):
			count = 0
			for m in range(j, j + k):
				if s[i][m] == '.':
					count += 1
			if count == k:
				for m in range(j, j + k):
					temp[i][m] += 1
	for i in range(n):
		for j in range(n - k + 1):
			count = 0
			for m in range(j, j + k):
				if s[m][i] == '.':
					count += 1
			if count == k:
				for m in range(j, j + k):
					temp[m][i] += 1
	x = y = 1
	maxi = 0
	for i in range(n):
		for j in range(n):
			if maxi < temp[i][j]:
				(maxi, x, y) = (temp[i][j], i + 1, j + 1)
	print(x, y)
main()


def can_place(n, a, k, x, y, dir):
	hx = [1, 0]
	hy = [0, 1]
	if x < 0 or x >= n or y < 0 or (y >= n):
		return False
	if a[x][y] == '#':
		return False
	for i in range(k - 1):
		x += hx[dir]
		y += hy[dir]
		if x < 0 or x >= n or y < 0 or (y >= n):
			return False
		if a[x][y] == '#':
			return False
	return True

def solve(n, a, k):
	count = [[0] * n for _ in range(n)]
	for i in range(n):
		for j in range(n):
			if can_place(n, a, k, i, j, 0):
				for p in range(k):
					count[i + p][j] += 1
			if can_place(n, a, k, i, j, 1):
				for p in range(k):
					count[i][j + p] += 1
	row = 0
	col = 0
	max_ships = 0
	for i in range(n):
		for j in range(n):
			if count[i][j] > max_ships:
				max_ships = count[i][j]
				row = i
				col = j
	row += 1
	col += 1
	print(row, col)
(n, k) = map(int, input().split(' '))
a = []
for i in range(n):
	a.append(input())
solve(n, a, k)


(n, k) = map(int, input().split())
S = [input() for i in range(n)]
C = [[0] * n for i in range(n)]
for i in range(n):
	for j in range(n):
		if S[i][j] == '#':
			continue
		if i + k - 1 < n:
			for di in range(k):
				ni = i + di
				if S[ni][j] == '#':
					break
			else:
				for di in range(k):
					ni = i + di
					C[ni][j] += 1
		if j + k - 1 < n:
			for dj in range(k):
				nj = j + dj
				if S[i][nj] == '#':
					break
			else:
				for dj in range(k):
					nj = j + dj
					C[i][nj] += 1
maxc = 0
ans = (1, 1)
for i in range(n):
	for j in range(n):
		if C[i][j] >= maxc:
			maxc = C[i][j]
			ans = (i + 1, j + 1)
print(*ans)


(n, k) = map(int, input().split())
matrix = []
colums = [[] for i in range(n)]
for i in range(n):
	temp = list(map(str, input()))
	matrix.append(temp)
	for i in range(n):
		colums[i].append(temp[i])
ans = [[0] * n for i in range(n)]
ith = -1
for i in matrix:
	ith += 1
	count = 0
	for j in range(n - k + 1):
		count = i[j:j + k].count('.')
		if count == k:
			for l in range(j, j + k):
				ans[ith][l] += 1
ith = -1
for i in colums:
	ith += 1
	count = 0
	for j in range(n - k + 1):
		count = i[j:j + k].count('.')
		if count == k:
			for l in range(j, j + k):
				ans[l][ith] += 1
mx = 0
ans0 = 0
ans1 = 0
for i in range(n):
	for j in range(n):
		if ans[i][j] > mx:
			mx = ans[i][j]
			ans0 = i
			ans1 = j
print(ans0 + 1, ans1 + 1)


(n, k) = map(int, input().split())

def f(s, i):
	l = max(0, i - k + 1)
	p = max(s.rfind('#', l, i + 1), l - 1)
	r = min(n, i + k)
	q = s.find('#', i, r)
	if q < 0:
		q = r
	return max(0, q - p - k)
a = [[], []]
for _ in range(n):
	a[0].append(input())
a[1] = [''.join(s) for s in zip(*a[0])]
b = []
for i in range(n):
	for j in range(n):
		b.append([f(a[0][i], j) + f(a[1][j], i), i, j])
b.sort()
print(b[-1][1] + 1, b[-1][2] + 1)


from collections import Counter
(n, k) = map(int, input().split())
arr = []
for i in range(0, n):
	s = list(input())
	arr.append(s)
result = []
for i in range(0, n):
	row = arr[i]
	count = 0
	for j in range(0, n):
		if row[j] == '.':
			count += 1
		elif row[j] == '#':
			count = 0
		if count >= k:
			for w in range(0, k):
				result.append([i + 1, j - w + 1])
temp = ''
column = list()
for i in range(0, n):
	for d in range(0, n):
		temp += arr[d][i]
	column = list(temp)
	count2 = 0
	for j in range(0, n):
		if column[j] == '.':
			count2 += 1
		elif column[j] == '#':
			count2 = 0
		if count2 >= k:
			for w in range(0, k):
				result.append([j - w + 1, i + 1])
	temp = ''
	column = list()
c = Counter()
for i in result:
	a = str(i[0]) + ' ' + str(i[1])
	c[a] += 1
for i in c.most_common():
	print(i[0])
	break
if len(c) == 0:
	print('1 1')


def grather(y, x):
	global max_val, max_x, max_y
	if Ver[y][x] > max_val:
		max_val = Ver[y][x]
		max_x = x
		max_y = y
(n, k) = map(int, input().split())
Table = []
Ver = [[0] * n for i in range(n)]
for i in range(n):
	Table.append(list(input()))
max_y = 0
max_x = 0
max_val = 0
for y in range(n):
	for x in range(n):
		if x + k <= n:
			clear = True
			for j in range(x, x + k):
				if Table[y][j] == '#':
					clear = False
					break
			if clear:
				for j in range(x, x + k):
					Ver[y][j] += 1
					grather(y, j)
		if y + k <= n:
			clear = True
			for j in range(y, y + k):
				if Table[j][x] == '#':
					clear = False
					break
			if clear:
				for j in range(y, y + k):
					Ver[j][x] += 1
					grather(j, x)
print(max_y + 1, max_x + 1)


(n, k) = [int(i) for i in input().split()]
s = ['' for i in range(n)]
a = [['' for i in range(n)] for j in range(n)]
b = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
	s[i] = str(input())
for i in range(n):
	for j in range(n):
		a[i][j] = s[i][j]
count = 0
for i in range(n):
	for j in range(n - k + 1):
		for c in range(k):
			if a[i][j + c] == '.':
				count += 1
		if count == k:
			for c in range(k):
				b[i][j + c] += 1
		count = 0
for i in range(n - k + 1):
	for j in range(n):
		for c in range(k):
			if a[i + c][j] == '.':
				count += 1
		if count == k:
			for c in range(k):
				b[i + c][j] += 1
		count = 0
imax = 0
jmax = 0
for i in range(n):
	for j in range(n):
		if b[i][j] > b[imax][jmax]:
			imax = i
			jmax = j
print(imax + 1, jmax + 1)


def check1(a, b):
	po1 = [(i + a, b) for i in range(k)]
	flag = True
	for i in range(k):
		(x, y) = (po1[i][0], po1[i][1])
		if field[y][x] == '#':
			flag = False
			break
	if flag:
		for a in range(k):
			(x, y) = (po1[a][0], po1[a][1])
			t[y][x] += 1

def check2(a, b):
	po1 = [(a, b + i) for i in range(k)]
	flag = True
	for i in range(k):
		(x, y) = (po1[i][0], po1[i][1])
		if field[y][x] == '#':
			flag = False
	if flag:
		for a in range(k):
			(x, y) = (po1[a][0], po1[a][1])
			t[y][x] += 1
(n, k) = map(int, input().split())
field = []
t = [[0] * n for i in range(n)]
for i in range(n):
	field.append(list(input()))
for x in range(n - k + 1):
	for y in range(n):
		check1(x, y)
for x in range(n):
	for y in range(n - k + 1):
		check2(x, y)
best = -1
best_cor = [-1, -1]
for x in range(n):
	for y in range(n):
		if t[y][x] > best:
			best = t[y][x]
			best_cor = [y + 1, x + 1]
print(*best_cor)


(n, k) = input().split()
n = int(n)
k = int(k)
map = [[0 for x in range(n)] for y in range(n)]
d = [[0 for x in range(n)] for y in range(n)]
for i in range(n):
	tmpRow = list(input())
	for j in range(n):
		if tmpRow[j] == '.':
			map[i][j] = 1
for i in range(n):
	for j in range(n):
		if map[i][j] == 0:
			continue
		if i + k <= n:
			vp = True
			for p in range(i, i + k):
				if map[p][j] == 0:
					vp = False
					break
			for p in range(i, i + k):
				d[p][j] += vp
		if j + k <= n:
			hp = True
			for p in range(j, j + k):
				if map[i][p] == 0:
					hp = False
					break
			for p in range(j, j + k):
				d[i][p] += hp
mx = 0
mxr = 0
mxc = 0
for i in range(n):
	for j in range(n):
		if d[i][j] > mx:
			mxr = i
			mxc = j
			mx = d[i][j]
print(mxr + 1, mxc + 1)


(n, k) = map(int, input().split())
field = [input() for _ in range(n)]
field_ = [''.join([field[i][j] for i in range(n)]) for j in range(n)]
for_ans = [[0] * n for i in range(n)]
for_s = '.' * k
for (i, val) in enumerate(field):
	for j in range(n - k + 1):
		if val[j:j + k] == for_s:
			for j_ in range(j, j + k):
				for_ans[i][j_] += 1
for (i, val) in enumerate(field_):
	for j in range(n - k + 1):
		if val[j:j + k] == for_s:
			for j_ in range(j, j + k):
				for_ans[j_][i] += 1
ans = 0
(x, y) = (1, 1)
for i in range(n):
	for j in range(n):
		if for_ans[i][j] > ans:
			ans = for_ans[i][j]
			x = i + 1
			y = j + 1
print(x, y)


(n, k) = map(int, input().split())
u = []
a = []
for i in range(n):
	u.append(list(input()) + ['#'])
	a.append([0] * n)
u.append(['#'] * n)
for i in range(n):
	for j in range(n):
		if u[i][j] == '.':
			ok = True
			for p in range(1, k):
				if u[i][j + p] != '.':
					ok = False
					break
			if ok:
				for p in range(k):
					a[i][j + p] += 1
			ok = True
			for p in range(1, k):
				if u[i + p][j] != '.':
					ok = False
					break
			if ok:
				for p in range(k):
					a[i + p][j] += 1
ma = 0
mi = (1, 1)
for i in range(n):
	for j in range(n):
		if a[i][j] > ma:
			ma = a[i][j]
			mi = (i + 1, j + 1)
print(mi[0], mi[1])


(n, k) = map(int, input().split())
s = []
for i in range(n):
	s.append(input())
p = [1, 1]
v = 0
for i in range(n):
	for j in range(n):
		if s[i][j] == '.':
			iv = i
			jv = j
			l = 0
			r = 0
			u = 0
			d = 0
			vc = 0
			while jv - 1 >= 0 and j - jv < k and (s[i][jv - 1] == '.'):
				jv -= 1
				l += 1
			jv = j
			while jv != n and jv - j < k and (s[i][jv] == '.'):
				jv += 1
				r += 1
			if l + r + 2 - k >= 0:
				vc = l + r + 2 - k
			while iv - 1 >= 0 and i - iv < k and (s[iv - 1][j] == '.'):
				iv -= 1
				u += 1
			iv = i
			while iv != n and iv - i < k and (s[iv][j] == '.'):
				iv += 1
				d += 1
			if u + d + 2 - k >= 0:
				vc += u + d + 2 - k
			if vc > v:
				v = vc
				p[0] = i + 1
				p[1] = j + 1
print(' '.join((str(i) for i in p)))


import sys
import os
import math
import re
(n, k) = map(int, input().split())
field = []
maxNum = 0
loc = (0, 0)

def verticalFits(i, j, field, k):
	openSlots = 1
	temp = i - 1
	while temp >= 0 and openSlots < k:
		if field[temp][j] == '.':
			openSlots += 1
			temp -= 1
		else:
			break
	temp = i + 1
	tempSlots = 1
	while temp < len(field[i]) and tempSlots < k:
		if field[temp][j] == '.':
			openSlots += 1
			temp += 1
			tempSlots += 1
		else:
			break
	if openSlots < k:
		return 0
	else:
		return 1 + openSlots - k

def horizontalFits(i, j, field, k):
	openSlots = 1
	temp = j - 1
	while temp >= 0 and openSlots < k:
		if field[i][temp] == '.':
			openSlots += 1
			temp -= 1
		else:
			break
	temp = j + 1
	tempSlots = 1
	while temp < len(field[i]) and tempSlots < k:
		if field[i][temp] == '.':
			tempSlots += 1
			openSlots += 1
			temp += 1
		else:
			break
	if openSlots < k:
		return 0
	else:
		return 1 + openSlots - k
for i in range(n):
	field.append(input())
for i in range(n):
	for j in range(n):
		if field[i][j] == '.':
			vert = verticalFits(i, j, field, k)
			hor = horizontalFits(i, j, field, k)
			if vert + hor > maxNum:
				maxNum = vert + hor
				loc = (i, j)
print(loc[0] + 1, loc[1] + 1)


from time import time
try:
	start = time()
	(fs, ss) = input().split()
	fs = int(fs)
	ss = int(ss)
	field = [[0] * fs for i in range(fs)]
	for i in range(fs):
		inp = input()
		for j in range(fs):
			if inp[j] == '#':
				field[i][j] = -1
	for i in range(fs):
		for j in range(fs):
			d = 1
			r = 1
			for k in range(ss):
				if i > fs - ss or field[i + k][j] == -1:
					r = 0
				if j > fs - ss or field[i][j + k] == -1:
					d = 0
				if r == 0 and d == 0:
					break
			if r == 1:
				for k in range(ss):
					field[i + k][j] += 1
			if d == 1:
				for k in range(ss):
					field[i][j + k] += 1
	max = 0
	for i in range(fs):
		for j in range(fs):
			if field[i][j] > max:
				max = field[i][j]
				maxi = i
				maxj = j
	print(maxi + 1, maxj + 1)
except:
	print(1, 1)


(a, b) = map(int, input().split())
z = [input() for _ in ' ' * a]
r = [[0] * a for _ in ' ' * a]
c = [[0] * a for _ in ' ' * a]
for i in range(a):
	for j in range(a - b + 1):
		ok = 1
		for k in range(b):
			if z[i][j + k] == '#':
				ok = 0
				break
		if ok:
			for k in range(b):
				r[i][j + k] += 1
		ok = 1
		for k in range(b):
			if z[j + k][i] == '#':
				ok = 0
				break
		if ok:
			for k in range(b):
				c[j + k][i] += 1
(i1, j1) = (1, 1)
ma = 0
for i in range(a):
	for j in range(a):
		if c[i][j] + r[i][j] > ma:
			i1 = i + 1
			j1 = j + 1
			ma = c[i][j] + r[i][j]
print(i1, j1)


def go():
	keep = {}
	(n, l) = (int(i) for i in input().split(' '))
	matrix = [None] * n
	for i in range(n):
		matrix[i] = [i for i in input()]
	for i in range(n):
		for j in range(n):
			if matrix[i][j] == '.':
				h = 0
				v = 0
				for k in range(l):
					if j + k < n and matrix[i][j + k] == '.':
						h += 1
					if i + k < n and matrix[i + k][j] == '.':
						v += 1
				if h == l:
					for k in range(l):
						keep.setdefault((i, j + k), 0)
						keep[i, j + k] += 1
				if v == l:
					for k in range(l):
						keep.setdefault((i + k, j), 0)
						keep[i + k, j] += 1
	if len(keep) != 0:
		import operator
		result = max(keep.items(), key=operator.itemgetter(1))[0]
		return '{} {}'.format(result[0] + 1, result[1] + 1)
	return '1 1'
print(go())


(n, k) = map(int, input().split())
a = []
dp = [[0] * n for i in range(n)]
for i in range(n):
	a.append(str(input()))
for i in range(n):
	for j in range(n - k + 1):
		t = 1
		for z in range(k):
			if a[i][j + z] == '#':
				t = 0
				break
		if t == 1:
			for z in range(k):
				dp[i][j + z] += 1
for j in range(n):
	for i in range(n - k + 1):
		t = 1
		for z in range(k):
			if a[i + z][j] == '#':
				t = 0
				break
		if t == 1:
			for z in range(k):
				dp[i + z][j] += 1
ih = 0
(x, y) = (0, 0)
for i in range(n):
	for j in range(n):
		now = dp[i][j]
		if now > ih:
			ih = now
			(x, y) = (i, j)
print(x + 1, y + 1)


(n, k) = list(map(int, input().split()))
matrix = []
for i in range(n):
	matrix.append(list(input()))
spree = 0
counts = [[0] * n for _ in range(n)]
for i in range(n):
	for j in range(n):
		if matrix[i][j] == '#':
			spree = 0
		else:
			spree += 1
			if spree == k:
				for z in range(j - k + 1, j + 1):
					counts[i][z] += 1
				spree = k - 1
	spree = 0
for i in range(n):
	for j in range(n):
		if matrix[j][i] == '#':
			spree = 0
		else:
			spree += 1
			if spree == k:
				for z in range(j - k + 1, j + 1):
					counts[z][i] += 1
				spree = k - 1
	spree = 0
(ans1, ans2) = (0, 0)
for i in range(n):
	for j in range(n):
		if counts[i][j] > counts[ans1][ans2]:
			ans1 = i
			ans2 = j
print('{} {}'.format(ans1 + 1, ans2 + 1))


(n, k) = map(int, input().split())

def f(x, d):
	a = x - d + 1
	if a < 1:
		return 0
	return a

def g(l, r, d):
	a = f(l + r, d)
	if a == 0:
		return 0
	return a - f(l - 1, d) - f(r - 1, d)
grid = []
for i in range(n):
	grid.append(input())
M = 0
ans = [0, 0]
for row in range(n):
	for col in range(n):
		if grid[row][col] == '.':
			i = col
			while i >= 0 and grid[row][i] == '.':
				i -= 1
			l = col - i - 1
			j = col
			while j <= n - 1 and grid[row][j] == '.':
				j += 1
			r = j - col - 1
			i = row
			while i >= 0 and grid[i][col] == '.':
				i -= 1
			u = row - i - 1
			j = row
			while j <= n - 1 and grid[j][col] == '.':
				j += 1
			d = j - row - 1
			if g(l, r, k - 1) + g(u, d, k - 1) > M:
				M = g(l, r, k - 1) + g(u, d, k - 1)
				ans = [row, col]
print(ans[0] + 1, ans[1] + 1)


(n, k) = map(int, input().split(' '))
l = []
l1 = []
for i in range(0, n):
	s = input()
	l.append(s)
	l1.append(n * [0])
a1 = 1
a2 = 1
maxx = 0
for i in range(0, n):
	for j in range(0, n - k + 1):
		if l[i][j:j + k] == k * '.':
			for m in range(0, k):
				l1[i][j + m] += 1
				if l1[i][j + m] > maxx:
					maxx = l1[i][j + m]
					a1 = i + 1
					a2 = j + m + 1
l2 = []
for i in range(0, n):
	s = ''
	for j in range(0, n):
		s += l[j][i]
	l2.append(s)
for i in range(0, n):
	for j in range(0, n - k + 1):
		if l2[i][j:j + k] == k * '.':
			for m in range(0, k):
				l1[j + m][i] += 1
				if l1[j + m][i] > maxx:
					maxx = l1[j + m][i]
					a1 = j + m + 1
					a2 = i + 1
print(a1, a2)


def fix(a, b, c):
	ret = min(a, c + k - 1) - max(c - k + 1, b) - k + 2
	return [0, ret][ret > 0]

def solve(row, col):
	a1 = a2 = row
	a3 = a4 = col
	while a1 + 1 >= 0 and a1 + 1 < n and (mp[a1 + 1][col] != '#'):
		a1 += 1
	while a2 - 1 >= 0 and a2 - 1 < n and (mp[a2 - 1][col] != '#'):
		a2 -= 1
	while a3 + 1 >= 0 and a3 + 1 < n and (mp[row][a3 + 1] != '#'):
		a3 += 1
	while a4 - 1 >= 0 and a4 - 1 < n and (mp[row][a4 - 1] != '#'):
		a4 -= 1
	return fix(a1, a2, row) + fix(a3, a4, col)
(n, k) = map(int, input().split())
mp = []
r = c = ans = 0
for _ in range(n):
	mp.append(input())
for i in range(n):
	for j in range(n):
		if mp[i][j] != '#':
			tp = solve(i, j)
			if tp > ans:
				ans = tp
				r = i
				c = j
print(r + 1, c + 1)


from sys import stdin
(n, k) = map(int, stdin.readline().strip().split())
grid = []
for i in range(n):
	grid.append(stdin.readline().strip())
counts = []
for i in range(n):
	counts.append([0] * n)

def fits(i, j, di, dj, k):
	for delta in range(k):
		if grid[i + delta * di][j + delta * dj] == '#':
			return False
	return True

def mark(i, j, di, dj, k):
	for delta in range(k):
		counts[i + delta * di][j + delta * dj] += 1
for i in range(n - k + 1):
	for j in range(n):
		if fits(i, j, 1, 0, k):
			mark(i, j, 1, 0, k)
for i in range(n):
	for j in range(n - k + 1):
		if fits(i, j, 0, 1, k):
			mark(i, j, 0, 1, k)
max_count = 0
(max_row, max_col) = (1, 1)
for i in range(n):
	for j in range(n):
		if counts[i][j] > max_count:
			max_count = counts[i][j]
			max_row = i + 1
			max_col = j + 1
print(max_row, max_col)


(n, k) = map(int, input().split())
m = []
for i in range(n):
	u = input()
	m.append(u)
v = [[0] * n for _ in range(n)]
for x in range(n - k + 1):
	for y in range(n):
		s = m[y][x:x + k]
		if not '#' in s:
			for i in range(k):
				v[y][x + i] += 1
for x in range(n):
	for y in range(n - k + 1):
		o = m[y:y + k]
		s = [o[q][x] for q in range(k)]
		if not '#' in s:
			for i in range(k):
				v[y + i][x] += 1
mx = 0
my = 0
m = v[0][0]
for i in range(n):
	for q in range(n):
		if v[i][q] > m:
			mx = q
			my = i
			m = v[i][q]
print(my + 1, mx + 1)


(n, k) = map(int, input().split())
l = []
m = []
hm = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
	l.append(input())
for i in range(n):
	x = ''
	for j in range(n):
		x += l[j][i]
	m.append(x)
for i in range(n):
	for j in range(n - k + 1):
		if l[i][j:j + k] == '.' * k:
			for p in range(j, j + k):
				hm[i][p] += 1
		if m[i][j:j + k] == '.' * k:
			for p in range(j, j + k):
				hm[p][i] += 1
ans = []
ind = []
for i in hm:
	z = max(i)
	ans.append(z)
	ind.append(i.index(z))
x = ans.index(max(ans))
print(x + 1, ind[x] + 1)


def battleship(arr, k):
	pts = [[0] * len(arr) for i in range(len(arr))]
	ans = [0, 0]
	maxi = 0
	for i in range(len(arr)):
		for j in range(len(arr)):
			if arr[i][j] == '.':
				good = 0
				count = 0
				flag = True
				s = i
				temp = []
				while s >= 0:
					if arr[s][j] == '.':
						temp.append([s, j])
						count += 1
						s -= 1
						if count == k:
							for (x, y) in temp:
								pts[x][y] += 1
								if pts[x][y] > maxi:
									maxi = pts[x][y]
									ans = [x + 1, y + 1]
							good += 1
							break
					else:
						break
				count = 0
				s = j
				temp = []
				while s >= 0:
					if arr[i][s] == '.':
						temp.append([i, s])
						count += 1
						s -= 1
						if count == k:
							for (x, y) in temp:
								pts[x][y] += 1
								if pts[x][y] > maxi:
									maxi = pts[x][y]
									ans = [x + 1, y + 1]
							good += 1
							break
					else:
						break
	if ans == [0, 0]:
		ans = [1, 1]
	print(*ans)
	return ''
(a, b) = map(int, input().strip().split())
blanck = []
for i in range(a):
	blanck.append(input())
print(battleship(blanck, b))


(n, k) = (int(x) for x in input().split())
field = []
for _ in range(n):
	field.append(list(input()))
stat = [[0 for _ in range(n)] for _ in range(n)]
for row in range(n):
	curr_zero_count = field[row][:k].count('#')
	curr_l = 0
	while True:
		if curr_zero_count == 0:
			for x in range(curr_l, curr_l + k):
				stat[row][x] += 1
		if curr_l + k >= n:
			break
		if field[row][curr_l] == '#':
			curr_zero_count -= 1
		if field[row][curr_l + k] == '#':
			curr_zero_count += 1
		curr_l += 1
for col in range(n):
	curr_zero_count = [field[x][col] for x in range(k)].count('#')
	curr_l = 0
	while True:
		if curr_zero_count == 0:
			for x in range(curr_l, curr_l + k):
				stat[x][col] += 1
		if field[curr_l][col] == '#':
			curr_zero_count -= 1
		if curr_l + k >= n:
			break
		if field[curr_l + k][col] == '#':
			curr_zero_count += 1
		curr_l += 1
mx = 0
ans = (1, 1)
for row in range(n):
	for col in range(n):
		if stat[row][col] > mx:
			mx = stat[row][col]
			ans = (row + 1, col + 1)
print(*ans)


d = dict()

def func(ch, i, n, d, k):
	c = 0
	for j in range(n):
		if ch[j] == '.':
			c += 1
		if ch[j] == '.' and j == n - 1 or ch[j] != '.':
			pos = j
			if ch[j] != '.':
				pos = j - 1
			if c >= k:
				for f in range(c - k + 1):
					for h in range(pos + 1 - c + f, pos + 1 - c + f + k):
						key = str(i) + ' ' + str(h + 1)
						if key in d:
							d[key] += 1
						else:
							d[key] = 1
			c = 0

def fun2(ch, i, n, d, k):
	c = 0
	for j in range(n):
		if ch[j] == '.':
			c += 1
		if ch[j] == '.' and j == n - 1 or ch[j] != '.':
			pos = j
			if ch[j] != '.':
				pos = j - 1
			if c >= k:
				for f in range(c - k + 1):
					for h in range(pos + 1 - c + f, pos + 1 - c + f + k):
						key = str(h + 1) + ' ' + str(i)
						if key in d:
							d[key] += 1
						else:
							d[key] = 1
			c = 0
(n, k) = map(int, input().split())
l = [''] * n
for i in range(n):
	ch = input()
	for h in range(n):
		l[h] += ch[h]
	func(ch, i + 1, n, d, k)
for i in range(n):
	fun2(l[i], i + 1, n, d, k)
m = 0
maxkey = ''
if d == dict():
	print('1 1')
else:
	for key in d.keys():
		if d[key] > m:
			maxkey = key
			m = d[key]
	print(maxkey)


a = [int(i) for i in input().split(' ')]
map = []
c2 = []
for i in range(a[0]):
	c2.append([0 for j in range(a[0])])
for i in range(a[0]):
	map.append(input())
counter = 0
for i in range(len(map)):
	counter = 0
	for j in range(len(map[i])):
		if map[i][j] == '.':
			counter += 1
		else:
			counter = 0
		if counter >= a[1]:
			k = j
			nu = 0
			while nu != a[1]:
				c2[i][k] += 1
				nu += 1
				k -= 1
for i in range(len(map)):
	counter = 0
	for j in range(len(map[i])):
		if map[j][i] == '.':
			counter += 1
		else:
			counter = 0
		if counter >= a[1]:
			k = j
			nu = 0
			while nu != a[1]:
				c2[k][i] += 1
				nu += 1
				k -= 1
mx = -100
for i in range(a[0]):
	for j in range(a[0]):
		if c2[i][j] > mx:
			mx = c2[i][j]
			line = i
			column = j
print(line + 1, column + 1)


def read():
	return list(map(int, input().split()))
(n, k) = read()
a = []
w = 0
q = []
for i in range(n):
	q.append(w)
b = []
for i in range(n):
	b.append(q.copy())
for i in range(n):
	a.append(input())
for i in range(n):
	for j in range(n - k + 1):
		for l in range(j, j + k):
			if a[i][l] == '#':
				break
		else:
			for l in range(j, j + k):
				b[i][l] += 1
for i in range(n):
	for j in range(n - k + 1):
		for l in range(j, j + k):
			if a[l][i] == '#':
				break
		else:
			for l in range(j, j + k):
				b[l][i] += 1
m = 0
ai = 1
aj = 1
for i in range(n):
	for j in range(n):
		if b[i][j] > m:
			m = b[i][j]
			ai = i + 1
			aj = j + 1
print(ai, aj)


class Matrix(object):

	def __init__(self, height, width):
		self.height = height
		self.width = width
		self.field = [[0 for col in range(self.width)] for row in range(self.height)]

	def fill(self, n=0):
		for row in range(self.height):
			for col in range(self.width):
				self.field[row][col] = n

	def get(self, row, col):
		return self.field[row][col]

	def set(self, row, col, n):
		self.field[row][col] = n

	def gi(self, seperator=' '):
		if seperator == '':
			for row in range(self.height):
				self.field[row] = [e for e in input()]
			return
		for row in range(self.height):
			self.field[row] = input().split(seperator)

	def rows(self):
		return self.field

	def cols(self):
		return [[self.field[row][col] for row in range(self.height)] for col in range(self.width)]

	def row(self, index):
		return self.field[index]

	def col(self, index):
		return [self.field[row][index] for row in range(self.height)]

	def visualize(self):
		print('\t', end='')
		for col in range(self.width):
			print(col, end='\t')
		print()
		print('_' * (self.width + 1) * 8)
		for row in range(self.height):
			print(str(row) + '\t', end='')
			for col in range(self.width):
				print(self.field[row][col], end='\t')
			print()
			print('_' * (self.width + 1) * 8)
line = [int(e) for e in input().split(' ')]
n = line[0]
ship = line[1]
M = Matrix(n, n)
rez = Matrix(n, n)
M.gi('')
for row in range(n):
	for col in range(n - ship + 1):
		if '#' not in M.row(row)[col:col + ship]:
			for k in range(col, col + ship):
				rez.set(row, k, rez.get(row, k) + 1)
for col in range(n):
	for row in range(n - ship + 1):
		if '#' not in M.col(col)[row:row + ship]:
			for k in range(row, row + ship):
				rez.set(k, col, rez.get(k, col) + 1)
ma = max([max(e) for e in rez.rows()])
for row in range(n):
	if ma in rez.row(row):
		print(str(row + 1) + ' ' + str(rez.row(row).index(ma) + 1))
		exit()


li = [int(i) for i in input().split()]
l = []
for i in range(li[0]):
	l.append(list(input()))
g = [[0] * li[0] for i in range(li[0])]
for i in range(li[0]):
	for j in range(li[0] - li[1] + 1):
		if all((l[i][j + x] == '.' for x in range(li[1]))):
			for k in range(li[1]):
				g[i][j + k] += 1
for j in range(li[0]):
	for i in range(li[0] - li[1] + 1):
		if all((l[i + x][j] == '.' for x in range(li[1]))):
			for k in range(li[1]):
				g[i + k][j] += 1
(y, z) = (-1, -1)
max = -1
for i in range(li[0]):
	for j in range(li[0]):
		if g[i][j] > max:
			max = g[i][j]
			(y, z) = (i + 1, j + 1)
print(y, z)


(n, k) = map(int, input().split())
a = []
for i in range(n):
	ai = list(map(lambda x: -1 if x == '#' else 0, list(input())))
	for i1 in range(n - k + 1):
		arr = ai[i1:i1 + k]
		if not -1 in arr:
			ai[i1:i1 + k] = [x + 1 for x in arr]
	a.append(ai)
a = list(map(list, zip(*a)))
for i in range(n):
	ai = a[i]
	for i1 in range(n - k + 1):
		arr = ai[i1:i1 + k]
		if not -1 in arr:
			ai[i1:i1 + k] = [x + 1 for x in arr]
a = list(map(list, zip(*a)))
a = [aij for ai in a for aij in ai]
b = a.index(max(a))
(br, bc) = divmod(b, n)
print('{} {}'.format(br + 1, bc + 1))


(n, k) = list(map(int, input().split(' ')))
rows = []
for i in range(n):
	rows += [input()]
cnt = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
	for j in range(n):
		flag = True
		for kk in range(k):
			if j + kk > n - 1 or rows[i][j + kk] == '#':
				flag = False
				break
		if flag:
			for kk in range(k):
				cnt[i][j + kk] += 1
		flag = True
		for kk in range(k):
			if i + kk > n - 1 or rows[i + kk][j] == '#':
				flag = False
				break
		if flag:
			for kk in range(k):
				cnt[i + kk][j] += 1
mx = 0
ia = 0
ij = 0
for i in range(n):
	for j in range(n):
		if cnt[i][j] > mx:
			mx = cnt[i][j]
			ia = i
			ij = j
print(ia + 1, ij + 1)


(n, k) = [int(x) for x in input().split()]
p = [0] * n
for x in range(n):
	p[x] = [x for x in input()]
res = [[0] * n for x in range(n)]
for y in range(n):
	for x in range(n):
		if x + k <= n:
			a = True
			for b in range(k):
				if p[y][x + b] == '#':
					a = False
			if a:
				for b in range(k):
					res[y][x + b] += 1
		if y + k <= n:
			a = True
			for b in range(k):
				if p[y + b][x] == '#':
					a = False
			if a:
				for b in range(k):
					res[y + b][x] += 1
ans = [0, 0]
m = 0
for y in range(n):
	for x in range(n):
		if res[y][x] > m:
			m = res[y][x]
			ans = [y, x]
print(ans[0] + 1, ans[1] + 1)


(n, k) = map(int, input().strip().split())
arr = []
for _ in range(n):
	arr.append(input().strip() + '#')
arr2 = [''.join((arr[i][j] for i in range(n))) + '#' for j in range(n)]
mat = [[0] * n for _ in range(n)]
for i in range(n):
	cur_start = arr[i].find('.', 0)
	cur_end = arr[i].find('#', cur_start)
	while cur_start != -1:
		if cur_end - cur_start >= k:
			for j in range(cur_start, cur_end):
				mat[i][j] += min(j + k - 1, cur_end - 1) - max(j - k + 1, cur_start) + 2 - k
		cur_start = arr[i].find('.', cur_end)
		cur_end = arr[i].find('#', cur_start)
arr = arr2
for i in range(n):
	cur_start = arr[i].find('.', 0)
	cur_end = arr[i].find('#', cur_start)
	while cur_start != -1:
		if cur_end - cur_start >= k:
			for j in range(cur_start, cur_end):
				mat[j][i] += min(j + k - 1, cur_end - 1) - max(j - k + 1, cur_start) + 2 - k
		cur_start = arr[i].find('.', cur_end)
		cur_end = arr[i].find('#', cur_start)
mx = 0
ps = (0, 0)
for i in range(n):
	for j in range(n):
		if mat[i][j] > mx:
			mx = mat[i][j]
			ps = (i, j)
print(ps[0] + 1, ps[1] + 1)


def make():
	s = ''
	for x in range(j, j + k):
		s += field[x][i]
	return s
(n, k) = map(int, input().split())
field = []
for i in range(n):
	field.append(input())
best = []
for i in range(n):
	best.append([0] * n)
for i in range(n):
	for j in range(n - k + 1):
		if field[i][j:j + k] == '.' * k:
			for x in range(j, j + k):
				best[i][x] += 1
for i in range(n):
	for j in range(n - k + 1):
		s = make()
		if s == '.' * k:
			for x in range(j, j + k):
				best[x][i] += 1
ind1 = 0
ind2 = 0
ans = -19942347392
for i in range(n):
	for j in range(n):
		if best[i][j] > ans:
			ans = best[i][j]
			ind1 = i
			ind2 = j
if ans > 0:
	print(ind1 + 1, ind2 + 1)
else:
	print(1, 1)


(n, k) = map(int, input().split())
arr = []
for i in range(n):
	arr.append(list(input()))
up = [[0] * n for i in range(n)]
down = [[0] * n for i in range(n)]
left = [[0] * n for i in range(n)]
right = [[0] * n for i in range(n)]
for i in range(n):
	up[0][i] = 1 if arr[0][i] == '.' else 0
	left[i][0] = 1 if arr[i][0] == '.' else 0
	right[i][n - 1] = 1 if arr[i][n - 1] == '.' else 0
	down[n - 1][i] = 1 if arr[n - 1][i] == '.' else 0
for i in range(1, n):
	for j in range(n):
		up[i][j] = up[i - 1][j] + 1 if arr[i][j] == '.' else 0
		left[j][i] = left[j][i - 1] + 1 if arr[j][i] == '.' else 0
		right[j][n - 1 - i] = right[j][n - i] + 1 if arr[j][n - 1 - i] == '.' else 0
		down[n - 1 - i][j] = down[n - i][j] + 1 if arr[n - 1 - i][j] == '.' else 0

def print_fn(arr):
	print('\n'.join([' '.join(map(str, ar)) for ar in arr]))
	print()
(mx, mxi) = (0, (0, 0))
for i in range(n):
	for j in range(n):
		horizontal = max(0, min(left[i][j], k) + min(right[i][j], k) - k)
		vertical = max(0, min(up[i][j], k) + min(down[i][j], k) - k)
		parts = horizontal + vertical
		if parts > mx:
			mx = max(mx, parts)
			mxi = (i, j)
print(mxi[0] + 1, mxi[1] + 1)


(n, k) = map(int, input().split())
l = [input() for i in range(n)]
d = [[0 for i in range(n)] for i in range(n)]
s = '.' * k
md = 0
for i in range(n):
	for j in range(n):
		if l[i][j:j + k] == s:
			for ii in range(k):
				d[i][j + ii] += 1
for i in range(n):
	for j in range(n):
		if l[j][i] == '.' and j + k <= n:
			jj = j
			while jj < j + k:
				if l[jj][i] == '.':
					d[jj][i] += 1
				else:
					jj -= 1
					while jj >= j:
						d[jj][i] -= 1
						jj -= 1
					break
				jj += 1
md = max(list(map(max, d)))
for i in range(n):
	for j in range(n):
		if d[i][j] == md:
			print(i + 1, j + 1)
			exit()


def scan():
	for i in range(n):
		for j in range(n - k + 1):
			f = True
			for l in range(k):
				if a[i][j + l] == '#':
					f = False
					break
			if f:
				for l in range(k):
					b[i][j + l] += 1
(n, k) = input().split()
n = int(n)
k = int(k)
a = [[]]
b = [[]]
for i in range(n):
	wk1 = input()
	for j in range(n):
		a[i].append(wk1[j])
		b[i].append(0)
	a.append([])
	b.append([])
scan()
for i in range(n):
	for j in range(i, n):
		if i != j:
			wk1 = a[i][j]
			a[i][j] = a[j][i]
			a[j][i] = wk1
			wk1 = b[i][j]
			b[i][j] = b[j][i]
			b[j][i] = wk1
scan()
ans_max = 0
anx_x = 1
anx_y = 1
for i in range(n):
	for j in range(n):
		if ans_max < b[j][i]:
			ans_max = b[j][i]
			anx_x = i + 1
			anx_y = j + 1
print(anx_x, anx_y)


(n, k) = map(int, input().split())
status = []
cnt = []
for i in range(n):
	status += [list(input())]
	cnt += [[0 for i in range(n)]]
for i in range(n):
	for g in range(n - k + 1):
		flag = 1
		for j in range(g, g + k):
			if status[i][j] == '#':
				flag = 0
				break
		if flag == 1:
			for j in range(g, g + k):
				cnt[i][j] += 1
for i in range(n):
	for g in range(n - k + 1):
		flag = 1
		for j in range(g, g + k):
			if status[j][i] == '#':
				flag = 0
				break
		if flag == 1:
			for j in range(g, g + k):
				cnt[j][i] += 1
x = y = 1
m_till = 0
for i in range(n):
	for j in range(n):
		if cnt[i][j] > m_till:
			m_till = cnt[i][j]
			x = i + 1
			y = j + 1
print(x, y)


(n, k) = map(int, input().split())
b = [[None] * n for i in range(n)]
for y in range(n):
	line = input()
	for (x, c) in enumerate(line):
		b[y][x] = c == '.'
res = [[0 for i in range(n)] for j in range(n)]
for y in range(n):
	for x in range(n - k + 1):
		for x2 in range(k):
			if not b[y][x + x2]:
				break
		else:
			for x2 in range(k):
				res[y][x + x2] += 1
for y in range(n - k + 1):
	for x in range(n):
		for y2 in range(k):
			if not b[y + y2][x]:
				break
		else:
			for y2 in range(k):
				res[y + y2][x] += 1
maxi = [0] * 3
for y in range(n):
	for x in range(n):
		maxi = max(maxi, [res[y][x], y, x])
print(maxi[1] + 1, maxi[2] + 1)


def count(s, i, k):
	l = max(0, i - k + 1)
	cl = s.rfind('#', l, i + 1)
	if cl < 0:
		cl = l - 1
	r = min(len(s), i + k)
	cr = s.find('#', i, r)
	if cr < 0:
		cr = r
	return max(0, cr - cl - k)
(n, k) = map(int, input().split())
a = [input() for _ in [0] * n]
b = [''.join(x) for x in zip(*a)]
m = im = jm = 0
for i in range(n):
	for j in range(n):
		c = count(a[i], j, k) + count(b[j], i, k)
		if c > m:
			(m, im, jm) = (c, i, j)
print(im + 1, jm + 1)


(n, k) = map(int, input().split())

def f(s, i):
	l = max(0, i - k + 1)
	c = s.rfind('#', l, i + 1)
	if c < 0:
		c = l - 1
	r = min(n, i + k)
	d = s.find('#', i, r)
	if d < 0:
		d = r
	return max(0, d - c - k)
r = range(n)
a = [input() for _ in r]
b = [''.join(x) for x in zip(*a)]
(m, i, j) = max(((f(a[i], j) + f(b[j], i), i, j) for i in r for j in r))
print(i + 1, j + 1)


(n, k) = map(int, input().split())
board = []
for i in range(n):
	board.append(input())
argmax = (0, 0)
best = -1
for i in range(n):
	for j in range(n):
		ans = 0
		if board[i][j] == '#':
			continue
		up = 0
		while i - up - 1 >= 0 and board[i - up - 1][j] == '.' and (up + 1 < k):
			up += 1
		down = 0
		while i + down + 1 < n and board[i + down + 1][j] == '.' and (down + 1 < k):
			down += 1
		left = 0
		while j - left - 1 >= 0 and board[i][j - left - 1] == '.' and (left + 1 < k):
			left += 1
		right = 0
		while j + right + 1 < n and board[i][j + right + 1] == '.' and (right + 1 < k):
			right += 1
		if up + down + 1 >= k:
			ans += up + down + 1 - k + 1
		if right + left + 1 >= k:
			ans += right + left + 1 - k + 1
		if ans > best:
			argmax = (i, j)
			best = ans
print(argmax[0] + 1, argmax[1] + 1)


from typing import Dict, List, Tuple

def input_lst() -> List[int]:
	return [int(x) for x in input().split()]

def print_out(res: List[int]):
	print(' '.join([str(x) for x in res]))

def main():
	(n, k) = (int(x) for x in input().split())
	field = []
	for _ in range(n):
		field.append([x == '.' for x in list(input())])
	res = [[0] * n for _ in range(n)]
	for i in range(n):
		for j in range(n):
			good = True
			for t in range(k):
				if j + t >= n or not field[i][j + t]:
					good = False
					break
			if good:
				for t in range(k):
					res[i][j + t] += 1
			good = True
			for t in range(k):
				if i + t >= n or not field[i + t][j]:
					good = False
					break
			if good:
				for t in range(k):
					res[i + t][j] += 1
	max_val = 0
	max_ind = (0, 0)
	for i in range(n):
		for j in range(n):
			if res[i][j] > max_val:
				max_ind = (i, j)
				max_val = res[i][j]
	print('{} {}'.format(max_ind[0] + 1, max_ind[1] + 1))
main()


(n, k) = map(int, input().split())
ai = [[0] * n for i in range(n)]
bi = [input() for i in range(n)]
maxIndexi = 0
maxIndexj = 0
for i in range(n):
	for j in range(n):
		if bi[i][j] == '#':
			continue
		maxIndexi = i
		maxIndexj = j
		temp = 1
		if k + i <= n:
			for i2 in range(i + 1, i + k):
				if bi[i2][j] == '#':
					break
				temp += 1
			if temp == k:
				for i2 in range(i, i + k):
					ai[i2][j] += 1
		temp = 1
		if k + j <= n:
			for j2 in range(j + 1, j + k):
				if bi[i][j2] == '#':
					break
				temp += 1
			if temp == k:
				for j2 in range(j, j + k):
					ai[i][j2] += 1
maxij = 0
for i in range(n):
	for j in range(n):
		if ai[i][j] > maxij:
			maxij = ai[i][j]
			maxIndexi = i
			maxIndexj = j
print(maxIndexi + 1, maxIndexj + 1)


(n, k) = map(int, input().split(' '))
grid = []
for i in range(n):
	grid.append(input().rstrip())
counts = [[0] * n for i in range(n)]
for i in range(0, n):
	for j in range(0, n - k + 1):
		if all((grid[i][j + dj] == '.' for dj in range(k))):
			for dj in range(k):
				counts[i][j + dj] += 1
for j in range(0, n):
	for i in range(0, n - k + 1):
		if all((grid[i + di][j] == '.' for di in range(k))):
			for di in range(k):
				counts[i + di][j] += 1
m = 0
mp = (1, 1)
for i in range(n):
	for j in range(n):
		if counts[i][j] > m:
			m = counts[i][j]
			mp = (i + 1, j + 1)
print(*mp)


import sys
input = sys.stdin.readline
(n, k) = list(map(int, input().split()))
m = [None] * n
d1 = [[0, 1], [0, -1]]
d2 = [[1, 0], [-1, 0]]
for i in range(n):
	m[i] = input()
max_num = 0
res = [1, 1]
for i in range(n):
	for j in range(n):
		if m[i][j] != '.':
			continue
		tmp = 0
		cnt = 1
		for x in d1:
			for z in range(1, k):
				if 0 <= i + x[0] * z < n and 0 <= j + x[1] * z < n and (m[i + x[0] * z][j + x[1] * z] == '.'):
					cnt += 1
				else:
					break
		tmp += max(cnt - k + 1, 0)
		cnt = 1
		for x in d2:
			for z in range(1, k):
				if 0 <= i + x[0] * z < n and 0 <= j + x[1] * z < n and (m[i + x[0] * z][j + x[1] * z] == '.'):
					cnt += 1
				else:
					break
		tmp += max(cnt - k + 1, 0)
		if tmp > max_num:
			res = [i + 1, j + 1]
			max_num = tmp
print(*res)


(n, k) = map(int, input().strip().split())
lst = []
lst_invert = []
lst_count = []
for i in range(n):
	lst_add = []
	for j in range(n):
		lst_add.append(0)
	lst_count.append(lst_add)
for i in range(n):
	lst.append(list(input().strip()))
for i in range(n):
	lst_add = []
	for j in range(n):
		if lst[i][j:j + k] == list('.' * k):
			for x in range(k):
				lst_count[i][j + x] += 1
		lst_add.append(lst[j][i])
	lst_invert.append(lst_add)
for i in range(n):
	for j in range(n):
		if lst_invert[i][j:j + k] == list('.' * k):
			for x in range(k):
				lst_count[j + x][i] += 1
maximum = 0
for i in lst_count:
	if maximum < max(i):
		maximum = max(i)
check = 0
for i in range(n):
	if max(lst_count[i]) == maximum:
		for j in range(n):
			if lst_count[i][j] == maximum:
				print(i + 1, j + 1)
				check = 1
				break
	if check == 1:
		break


(n, k) = map(int, input().split())

def func(i):
	return -1 if i == '#' else 0
l = []
for i in range(n):
	l.append(list(map(func, input())))
for i in range(n):
	for j in range(n - k + 1):
		if -1 not in l[i][j:j + k]:
			for t in range(k):
				l[i][j + t] += 1
l = list(zip(*l))
for i in range(n):
	l[i] = list(l[i])
for i in range(n):
	for j in range(n - k + 1):
		if -1 not in l[i][j:j + k]:
			for t in range(k):
				l[i][j + t] += 1
l = list(zip(*l))
(x, y) = (0, 0)
m = -1
for i in range(n):
	for j in range(n):
		if l[i][j] > m:
			x = i
			y = j
			m = l[i][j]
print(x + 1, y + 1)


import re
R = lambda : map(int, input().split())

def f(i, j):
	if a[i][j] == '#':
		return 0
	ii = i
	while ii >= 0 and a[ii][j] == '.' and (i - ii <= k - 1):
		ii -= 1
	n1 = i - ii
	ii = i
	while ii < n and a[ii][j] == '.' and (ii - i <= k - 1):
		ii += 1
	n2 = ii - i
	t1 = max(n1 + n2 - k, 0)
	jj = j
	while jj >= 0 and a[i][jj] == '.' and (j - jj <= k - 1):
		jj -= 1
	n1 = j - jj
	jj = j
	while jj < n and a[i][jj] == '.' and (jj - j <= k - 1):
		jj += 1
	n2 = jj - j
	t2 = max(n1 + n2 - k, 0)
	return t1 + t2

def func():
	maxi = maxj = maxv = 0
	for i in range(n):
		for j in range(n):
			v = f(i, j)
			if v > maxv:
				maxi = i
				maxj = j
				maxv = v
	return (maxi + 1, maxj + 1)
(n, k) = R()
a = []
for i in range(n):
	a.append(input())
(i, j) = func()
print(i, j)


[n, k] = map(int, input().strip().split())
field = [input().strip() for _ in range(n)]

def stranspose(field, n):
	return [''.join((field[i][j] for i in range(n))) for j in range(n)]

def ceil(a, b):
	return -(-a // b)

def getz(l, k):
	if l < k:
		return [0 for _ in range(l)]
	else:
		m = min(l - k + 1, k)
		w = l - 2 * (m - 1)
		return list(range(1, m)) + [m for _ in range(w)] + list(reversed(range(1, m)))

def sproc(s, k):
	res = []
	l = 0
	for c in s:
		if c == '#':
			if l > 0:
				res.extend(getz(l, k))
				l = 0
			res.append(0)
		else:
			l += 1
	if l > 0:
		res.extend(getz(l, k))
	return res
MH = [sproc(s, k) for s in field]
fieldT = stranspose(field, n)
MVT = [sproc(s, k) for s in fieldT]
best = (0, 0, 0)
for i in range(n):
	for j in range(n):
		best = max(best, (MH[i][j] + MVT[j][i], i, j))
print(best[1] + 1, best[2] + 1)


(n, k) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
(m, x, y) = (-1, 0, 0)
for i in range(n):
	for j in range(n):
		if a[i][j] == '#':
			continue
		R = 0
		while j + R < n:
			if a[i][j + R] == '#':
				break
			if R == k:
				break
			R += 1
		L = 0
		while j - L >= 0:
			if a[i][j - L] == '#':
				break
			if L == k:
				break
			L += 1
		U = 0
		while i - U >= 0:
			if a[i - U][j] == '#':
				break
			if U == k:
				break
			U += 1
		D = 0
		while i + D < n:
			if a[i + D][j] == '#':
				break
			if D == k:
				break
			D += 1
		z = min(k, max(0, L + R - k)) + min(k, max(0, U + D - k))
		if z > m:
			(m, x, y) = (z, j, i)
print(y + 1, x + 1)


(n, k) = map(int, input().split())
g = [input() for i in range(n)]
c = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
	for j in range(n):
		if j + k <= n:
			for x in range(k):
				if g[i][j + x] != '.':
					break
			else:
				for x in range(k):
					c[i][j + x] += 1
		if i + k <= n:
			for x in range(k):
				if g[i + x][j] != '.':
					break
			else:
				for x in range(k):
					c[i + x][j] += 1
m = max((max(c[i]) for i in range(n)))
for i in range(n):
	for j in range(n):
		if c[i][j] == m:
			print(i + 1, j + 1)
			exit(0)


(map_size, ship_size) = list(map(int, input().split()))
map = [[0 for _ in range(map_size)] for _ in range(map_size)]
for i in range(map_size):
	tmpRow = list(input())
	for j in range(map_size):
		if tmpRow[j] == '.':
			map[i][j] = 1
results = [[0 for _ in range(map_size)] for _ in range(map_size)]
(max_i, max_j) = (0, 0)
max_value = 0
for i in range(map_size):
	for j in range(map_size):
		if map[i][j] == 1:
			tmp_cnt = 0
			for k in range(j, min(j + ship_size, map_size)):
				if map[i][k] == 1:
					tmp_cnt += 1
				if tmp_cnt == ship_size:
					for p in range(j, min(j + ship_size, map_size)):
						results[i][p] += 1
			tmp_cnt = 0
			for k in range(i, min(i + ship_size, map_size)):
				if map[k][j] == 1:
					tmp_cnt += 1
				if tmp_cnt == ship_size:
					for p in range(i, min(i + ship_size, map_size)):
						results[p][j] += 1
for i in range(map_size):
	for j in range(map_size):
		if results[i][j] > max_value:
			max_value = results[i][j]
			max_i = i
			max_j = j
print(max_i + 1, max_j + 1)


(n, k) = map(int, input().split())
A = []
B = []
for i in range(0, n):
	s = str(input())
	A.append(s)
for i in range(0, n * n):
	B.append(0)
for i in range(0, n):
	for j in range(0, n - k + 1):
		flag = 0
		for l in range(j, j + k):
			if A[i][l] == '#':
				flag = 1
		if flag == 0:
			for l in range(j, j + k):
				B[i * n + l] += 1
for i in range(0, n):
	for j in range(0, n - k + 1):
		flag = 0
		for l in range(j, j + k):
			if A[l][i] == '#':
				flag = 1
		if flag == 0:
			for l in range(j, j + k):
				B[l * n + i] += 1
maxi = 0
j = 0
for i in range(0, n * n):
	if B[i] > maxi:
		j = i
		maxi = B[i]
print(int(j / n) + 1, j % n + 1)


(n, k) = [int(i) for i in input().split()]
B = [input() for _ in range(n)]
C = [[0] * n for _ in range(n)]
for i in range(n):
	for j in range(n - k + 1):
		for l in range(j, j + k):
			if B[i][l] == '#':
				break
		else:
			for l in range(j, j + k):
				C[i][l] += 1
for j in range(n):
	for i in range(n - k + 1):
		for l in range(i, i + k):
			if B[l][j] == '#':
				break
		else:
			for l in range(i, i + k):
				C[l][j] += 1
cmax = 0
imax = jmax = 0
for i in range(n):
	for j in range(n):
		if C[i][j] > cmax:
			cmax = C[i][j]
			(imax, jmax) = (i, j)
print(imax + 1, jmax + 1)


from collections import Counter
(n, k) = map(int, input().split())
v = [input().strip() for _ in range(n)]
s = Counter()
for i in range(n):
	for j in range(n):
		if all((x < n and v[x][j] == '.' for x in range(i, i + k))):
			s.update(((x + 1, j + 1) for x in range(i, i + k)))
		if all((x < n and v[i][x] == '.' for x in range(j, j + k))):
			s.update(((i + 1, x + 1) for x in range(j, j + k)))
if len(s) == 0:
	s[1, 1] += 1
print(*s.most_common(1)[0][0])


(n, k) = map(int, input().split())
m = [list(input()) for _ in range(n)]
p = [[0 for _ in range(n)] for _ in range(n)]
for i in range(n):
	for j in range(n):
		s = True
		if i + k - 1 < n:
			for l in range(k):
				if m[i + l][j] != '.':
					s = False
					break
			if s:
				for l in range(k):
					p[i + l][j] += 1
		s = True
		if j + k - 1 < n:
			for l in range(k):
				if m[i][j + l] != '.':
					s = False
					break
			if s:
				for l in range(k):
					p[i][j + l] += 1
mx = -1
for i in range(n):
	for j in range(n):
		if p[i][j] > mx:
			ans = (i + 1, j + 1)
			mx = p[i][j]
print(*ans)


from itertools import product
(n, k) = map(int, input().split())
l = [input() for _ in range(n)]
m = [[0] * n for _ in range(n)]
for step in [1, 0]:
	for (y, s, row) in zip(range(n), l, m):
		x = 0
		for w in s.split('#'):
			le = len(w)
			if le >= k:
				d = min(k, le - k + 1)
				patch = [d] * le
				for i in range(1, d):
					patch[i - 1] = patch[le - i] = i
				for (i, d) in enumerate(patch, x):
					row[i] += d
			x += le + 1
	if step:
		l = [''.join(c) for c in zip(*l)]
		m = [list(c) for c in zip(*m)]
(y, x) = max(product(range(n), repeat=2), key=lambda t: m[t[1]][t[0]])
print(y + 1, x + 1)


(n, k) = map(int, input().split())
s = []
for i in range(n):
	s.append(input())
p = [1, 1]
v = 0
for i in range(n):
	for j in range(n):
		if s[i][j] == '.':
			iv = i
			jv = j
			vi = 0
			vj = 0
			while jv - 1 >= 0 and j - jv < k and (s[i][jv - 1] == '.'):
				jv -= 1
			while jv != n and jv - j < k and (s[i][jv] == '.'):
				jv += 1
				vj += 1
			if vj - (k - 1) < 0:
				vj = 0
			else:
				vj -= k - 1
			while iv - 1 >= 0 and i - iv < k and (s[iv - 1][j] == '.'):
				iv -= 1
			while iv != n and iv - i < k and (s[iv][j] == '.'):
				iv += 1
				vi += 1
			if vi - (k - 1) < 0:
				vi = 0
			else:
				vi -= k - 1
			if vi + vj > v:
				v = vi + vj
				p[0] = i + 1
				p[1] = j + 1
print(' '.join((str(i) for i in p)))


(n, k) = map(int, input().split())

def auxiliary(strings, index):
	leftIndex = max(0, index - k + 1)
	c = strings.rfind('#', leftIndex, index + 1)
	rightIndex = min(n, index + k)
	d = strings.find('#', index, rightIndex)
	if c < 0:
		c = leftIndex - 1
	if d < 0:
		d = rightIndex
	return max(0, d - c - k)
r = range(n)
a = [input() for _ in r]
b = [''.join(_) for _ in zip(*a)]
(_, i, j) = max([(auxiliary(a[i], j) + auxiliary(b[j], i), i, j) for i in r for j in r])
print(i + 1, j + 1)


(n, k) = [int(x) for x in input().split()]
a = []
for i in range(n):
	s = input()
	a.append(s)
(mx, I, J) = (0, 0, 0)
for i in range(n):
	for j in range(n):
		if a[i][j] == '#':
			continue
		(iup, ido) = (i, i)
		(jup, jdo) = (j, j)
		while iup >= 0 and a[iup][j] == '.':
			iup -= 1
		while ido < n and a[ido][j] == '.':
			ido += 1
		while jup >= 0 and a[i][jup] == '.':
			jup -= 1
		while jdo < n and a[i][jdo] == '.':
			jdo += 1
		iup = max(iup + 1, i - k + 1)
		ido = min(ido - 1, i + k - 1)
		jup = max(jup + 1, j - k + 1)
		jdo = min(jdo - 1, j + k - 1)
		tmp = max(ido - iup + 1 - (k - 1), 0) + max(0, jdo - jup + 1 - (k - 1))
		if tmp > mx:
			mx = tmp
			(I, J) = (i, j)
print(I + 1, end=' ')
print(J + 1)


import re
readin = input()
readin_list = re.split('[ ]', readin)
readin_list = list(map(int, readin_list))
battle_map = []
battle_result = [[0] * readin_list[0] for i in range(0, readin_list[0])]
for i in range(0, readin_list[0]):
	map_tmp = input()
	battle_map.append(map_tmp)
for i in range(0, readin_list[0]):
	record_row = [0] * readin_list[0]
	record_col = [0] * readin_list[0]
	if battle_map[i][0] == '#':
		record_row[0] = 0
	else:
		record_row[0] = 1
	if battle_map[0][i] == '#':
		record_col[0] = 0
	else:
		record_col[0] = 1
	for j in range(1, readin_list[0]):
		if battle_map[i][j] == '#':
			record_row[j] = 0
		else:
			record_row[j] = record_row[j - 1] + 1
			if record_row[j] >= readin_list[1]:
				for k in range(j - readin_list[1] + 1, j + 1):
					battle_result[i][k] += 1
		if battle_map[j][i] == '#':
			record_col[j] = 0
		else:
			record_col[j] = record_col[j - 1] + 1
			if record_col[j] >= readin_list[1]:
				for k in range(j - readin_list[1] + 1, j + 1):
					battle_result[k][i] += 1
ans = ans_i = ans_j = -1
for i in range(0, readin_list[0]):
	for j in range(0, readin_list[0]):
		if battle_result[i][j] > ans:
			ans = battle_result[i][j]
			ans_i = i
			ans_j = j
print('%d %d' % (ans_i + 1, ans_j + 1))


(n, k) = [int(i) for i in input().split(' ')]
grid = [input() for i in range(n)]
grid_score = [[0 for i in range(n)] for j in range(n)]
for row in range(n):
	for col in range(n - k + 1):
		if all(['.' == grid[row][col + x] for x in range(k)]):
			for x in range(k):
				grid_score[row][col + x] += 1
for row in range(n - k + 1):
	for col in range(n):
		if all(['.' == grid[row + x][col] for x in range(k)]):
			for x in range(k):
				grid_score[row + x][col] += 1
max_score = 0
max_row = 0
max_col = 0
for row in range(n):
	for col in range(n):
		if grid_score[row][col] > max_score:
			max_score = grid_score[row][col]
			max_row = row
			max_col = col
print(max_row + 1, max_col + 1)


from sys import stdin, stdout
from math import factorial
from math import log10
(n, k) = map(int, stdin.readline().split())
used = [[0 for i in range(n)] for j in range(n)]
maps = []
for i in range(n):
	maps.append(stdin.readline().strip())
for i in range(n):
	for j in range(n):
		if i + k <= n:
			label = 1
			for z in range(k):
				if maps[i + z][j] == '#':
					label = 0
			if label:
				for z in range(k):
					used[i + z][j] += 1
		if j + k <= n:
			label = 1
			for z in range(k):
				if maps[i][j + z] == '#':
					label = 0
			if label:
				for z in range(k):
					used[i][j + z] += 1
(s, c) = (0, 0)
for i in range(n):
	for j in range(n):
		if used[i][j] > used[s][c]:
			(s, c) = (i, j)
stdout.write(str(s + 1) + ' ' + str(c + 1))


(n, k) = map(int, input().split())
s = [[] for _ in range(n)]
for i in range(n):
	s[i] = input()
f = [[1 for d in range(n)] for _ in range(n)]
for i in range(n):
	for j in range(n):
		ssum = 0
		for t in range(j, min(j + k, n)):
			if s[i][t] == '.':
				ssum += 1
			else:
				break
		if ssum >= k:
			for t in range(k):
				f[i][j + t] = f[i][j + t] + 1
for i in range(n):
	for j in range(n):
		ssum = 0
		for t in range(j, min(n, j + k)):
			if s[t][i] == '.':
				ssum += 1
			else:
				break
		if ssum >= k:
			for t in range(k):
				f[j + t][i] += 1
(ans, ans_x, ans_y) = (0, 0, 0)
for i in range(n):
	for j in range(n):
		if ans < f[i][j]:
			ans = f[i][j]
			ans_x = i + 1
			ans_y = j + 1
print(ans_x, ans_y)


(n, k) = [int(x) for x in input().split()]
Map = []
Map.append(['#'] * (n + 4))
Map.append(['#'] * (n + 4))
for i in range(n):
	s = ['#', '#']
	s.extend(list(input()))
	s.extend(['#', '#'])
	Map.append(s)
Map.append(['#'] * (n + 4))
Map.append(['#'] * (n + 4))
maxi = 0
max_i = 2
max_j = 2
for i in range(2, n + 2):
	for j in range(2, n + 2):
		if Map[i][j] == '.':
			count = 0
			s_i = i
			s_j = j
			d = -1
			while Map[s_i][s_j] != '#' and d < k - 1:
				s_i += 1
				d += 1
			u = 0
			s_i = i
			s_j = j
			u = -1
			while Map[s_i][s_j] != '#' and u < k - 1:
				s_i -= 1
				u += 1
			s_i = i
			s_j = j
			r = -1
			while Map[s_i][s_j] != '#' and r < k - 1:
				s_j += 1
				r += 1
			s_i = i
			s_j = j
			l = -1
			while Map[s_i][s_j] != '#' and l < k - 1:
				s_j -= 1
				l += 1
			count = 0
			if u + d + 1 >= k:
				count += u + d + 2 - k
			if l + r + 1 >= k:
				count += l + r + 2 - k
			if count > maxi:
				maxi = count
				max_i = i
				max_j = j
print(max_i - 1, max_j - 1)


n = input().split()
r = int(n[0])
k = int(n[1])
l = []
for i in range(r):
	li = input()
	l.append(li)
rl = []
for i in range(r):
	x = []
	for j in range(r):
		x.append(0)
	rl.append(x)
for i in range(r):
	for j in range(len(l[i])):
		flag = 0
		f = 0
		if j + k <= r:
			for q in range(k):
				if l[i][j + q:j + q + 1] == '.':
					continue
				else:
					flag = 1
					break
			if flag == 0:
				for q in range(k):
					rl[i][j + q] = rl[i][j + q] + 1
			if flag == 1:
				j = q + 1
for i in range(r):
	for j in range(r):
		flag = 0
		f = 0
		if j + k <= r:
			for q in range(k):
				if l[j + q][i:i + 1] == '.':
					continue
				else:
					flag = 1
					break
			if flag == 0:
				for q in range(k):
					rl[j + q][i] = rl[j + q][i] + 1
			if flag == 1:
				j = q + 1
maxi = 0
maxj = 0
m = 0
for i in range(r):
	for j in range(r):
		if rl[i][j] > m:
			m = rl[i][j]
			maxi = i
			maxj = j
print(maxi + 1, maxj + 1)


(n, k) = map(int, input().split())
matrix = [[0 for i in range(n)] for j in range(n)]
possible = [[0 for i in range(n)] for j in range(n)]
cell = (1, 1)
for i in range(n):
	s = input()
	for j in range(len(s)):
		if s[j] == '#':
			matrix[i][j] = 1
			cell = (i + 1, j + 1)
		else:
			matrix[i][j] = 0
for i in range(n):
	s = sum(matrix[i][:k])
	if s == 0:
		for l in range(k):
			possible[i][l] += 1
	for j in range(1, n - k + 1):
		if matrix[i][j - 1] == 1:
			s -= 1
		if matrix[i][k - 1 + j] == 1:
			s += 1
		if s == 0:
			for l in range(j, j + k):
				possible[i][l] += 1
for i in range(n):
	s = 0
	for x in range(k):
		s += matrix[x][i]
	if s == 0:
		for l in range(k):
			possible[l][i] += 1
	for j in range(1, n - k + 1):
		if matrix[j - 1][i] == 1:
			s -= 1
		if matrix[k - 1 + j][i] == 1:
			s += 1
		if s == 0:
			for l in range(j, j + k):
				possible[l][i] += 1
if k == 1:
	for i in range(n):
		for j in range(n):
			possible[i][j] //= 2
MAX = 0
for i in range(n):
	for j in range(n):
		if possible[i][j] > MAX:
			MAX = possible[i][j]
			cell = (i + 1, j + 1)
print(*cell)


(n, k) = map(int, input().split())
a = []
for _ in range(n):
	a.append(input())
b = []
for i in range(n):
	for j in range(n):
		t = 0
		if a[i][j] == '.':
			x = 1
			for l in range(max(i - k + 1, 0), i)[::-1]:
				if a[l][j] == '.':
					x += 1
				else:
					break
			for l in range(i + 1, min(i + k, n)):
				if a[l][j] == '.':
					x += 1
				else:
					break
			t += max(0, x - k + 1)
			x = 1
			for l in range(max(j - k + 1, 0), j)[::-1]:
				if a[i][l] == '.':
					x += 1
				else:
					break
			for l in range(j + 1, min(j + k, n)):
				if a[i][l] == '.':
					x += 1
				else:
					break
			t += max(0, x - k + 1)
		b.append([t, i, j])
b.sort()
print(b[-1][1] + 1, b[-1][2] + 1)


class Cell:

	def __init__(self, y, x, open):
		self.open = open
		self.y = y
		self.x = x
		self.count = 0

class Field:

	def __init__(self, battlefield):
		self.cells = []
		for (y, line) in enumerate(battlefield):
			new_line = []
			for (x, cell) in enumerate(line):
				new_line.append(Cell(y, x, True if cell == '#' else False))
			self.cells.append(new_line)
(n, k) = [int(el) for el in input().split(' ')]
battlefield = []
for i in range(n):
	battlefield.append(input())
battlefield = Field(battlefield)
for y in range(n):
	for x in range(n - k + 1):
		suited = True
		for i in range(x, x + k):
			if battlefield.cells[y][i].open:
				suited = False
				break
		if suited:
			for i in range(x, x + k):
				battlefield.cells[y][i].count += 1
for x in range(n):
	for y in range(n - k + 1):
		suited = True
		for i in range(y, y + k):
			if battlefield.cells[i][x].open:
				suited = False
				break
		if suited:
			for i in range(y, y + k):
				battlefield.cells[i][x].count += 1
max_count = -1
x_max = 0
y_max = 0
for y in range(n):
	for x in range(n):
		if battlefield.cells[y][x].count > max_count:
			max_count = battlefield.cells[y][x].count
			x_max = x
			y_max = y
print('{} {}'.format(y_max + 1, x_max + 1))


from collections import Counter

def read_nums():
	return [int(x) for x in input().split()]

def read_board(n):
	board = []
	for _ in range(n):
		board.append(input())
	return board

def check_horizontal(board, boat_size, col_index, row_index):
	for i in range(col_index, col_index + boat_size):
		if i >= len(board):
			return False
		if board[row_index][i] == '#':
			return False
	return True

def check_vertical(board, boat_size, col_index, row_index):
	for i in range(row_index, row_index + boat_size):
		if i >= len(board):
			return False
		if board[i][col_index] == '#':
			return False
	return True

def main():
	(n, k) = read_nums()
	board = read_board(n)
	counter = Counter()
	for row_index in range(n):
		for col_index in range(n):
			if check_horizontal(board, k, col_index, row_index):
				for i in range(col_index, col_index + k):
					counter[row_index, i] += 1
			if check_vertical(board, k, col_index, row_index):
				for i in range(row_index, row_index + k):
					counter[i, col_index] += 1
	res = (0, 0)
	for (k, v) in list(counter.items()):
		if v > counter[res]:
			res = k
	print(res[0] + 1, res[1] + 1)

def __starting_point():
	main()
__starting_point()


(n, k) = [int(x) for x in input().split()]
m = ['' for i in range(n)]
for i in range(n):
	m[i] = input()
ret = 0
(x, y) = (0, 0)
for i in range(n):
	for j in range(n):
		if m[i][j] == '.':
			ways = 0
			(l, r, u, d) = (0, 0, 0, 0)
			while i - l >= 0 and m[i - l][j] == '.' and (l < k):
				l += 1
			while i + r < n and m[i + r][j] == '.' and (r < k):
				r += 1
			ways += max(0, l + r - k)
			while j - u >= 0 and m[i][j - u] == '.' and (u < k):
				u += 1
			while j + d < n and m[i][j + d] == '.' and (d < k):
				d += 1
			ways += max(0, u + d - k)
			if ways > ret:
				ret = ways
				x = i
				y = j
print(x + 1, y + 1)


(k, n) = input().split()
k = int(k)
n = int(n)
a = []
for st in range(k):
	a.append(list(input()))

def get_max(matrix, r):
	max = 0
	maxR = 0
	maxC = 0
	for r in range(k):
		for c in range(k):
			if type(matrix[r][c]) is int and matrix[r][c] > max:
				max = matrix[r][c]
				maxR = r
				maxC = c
	return '{} {}'.format(maxR + 1, maxC + 1)

def check_horizontal(matrix, lenght, row, column):
	h = 1
	for l in range(lenght - 1):
		if matrix[row][column + l + 1] == '#':
			h = 0
			break
	return h

def check_vertical(matrix, lenght, row, column):
	v = 1
	for l in range(lenght - 1):
		if matrix[row + l + 1][column] == '#':
			v = 0
			break
	return v
for row in range(k - n + 1):
	for column in range(k):
		if a[row][column] != '#':
			if check_vertical(a, n, row, column):
				for l in range(n):
					if a[row + l][column] == '.':
						a[row + l][column] = 1
					else:
						a[row + l][column] += 1
for column in range(k - n + 1):
	for row in range(k):
		if a[row][column] != '#':
			if check_horizontal(a, n, row, column):
				for l in range(n):
					if a[row][column + l] == '.':
						a[row][column + l] = 1
					else:
						a[row][column + l] += 1
print(get_max(a, k))


import math
(n, k) = map(int, input().split())
b = [list(input()) for _ in range(n)]
c = [[0] * n for _ in range(n)]
for i in range(n):
	for j in range(n):
		if b[i][j] == '.':
			if i + k <= n:
				f = True
				for z in range(1, k):
					if b[i + z][j] != '.':
						f = False
						break
				if f:
					for z in range(0, k):
						c[i + z][j] += 1
			if j + k <= n:
				f = True
				for z in range(1, k):
					if b[i][j + z] != '.':
						f = False
						break
				if f:
					for z in range(0, k):
						c[i][j + z] += 1
m = [0, 0]
for i in range(n):
	for j in range(n):
		if c[i][j] > c[m[0]][m[1]]:
			m = [i, j]
print('%i %i' % (m[0] + 1, m[1] + 1))


import math
(n, k) = [int(s) for s in input().split()]
board = []
for i in range(n):
	board.append(list(input()))
vb = [[0] * n for i in range(n)]
hb = [[0] * n for i in range(n)]
tb = [[0] * n for i in range(n)]
for i in range(n):
	for j in range(n):
		if board[i][j] == '.':
			open = True
			for p in range(j, j + k):
				if p >= n or board[i][p] == '#':
					open = False
					break
			if open:
				for p in range(j, j + k):
					vb[i][p] += 1
for i in range(n):
	for j in range(n):
		if board[j][i] == '.':
			open = True
			for p in range(j, j + k):
				if p >= n or board[p][i] == '#':
					open = False
					break
			if open:
				for p in range(j, j + k):
					hb[p][i] += 1
for i in range(n):
	for j in range(n):
		tb[i][j] = vb[i][j] + hb[i][j]
mc = (0, 0)
for i in range(n):
	for j in range(n):
		if tb[i][j] > tb[mc[0]][mc[1]]:
			mc = (i, j)
print(mc[0] + 1, mc[1] + 1)


(n, k) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
ma = 0
x = 0
yans = 0
for i in range(n):
	for j in range(n):
		c = 0
		l = 0
		while l < k and i - l >= 0 and (a[i - l][j] == '.'):
			l += 1
		r = 0
		while r < k and i + r < n and (a[i + r][j] == '.'):
			r += 1
		c += max(0, r + l - k)
		if k != 1:
			l = 0
			while l < k and j - l >= 0 and (a[i][j - l] == '.'):
				l += 1
			r = 0
			while r < k and j + r < n and (a[i][j + r] == '.'):
				r += 1
			c += max(0, r + l - k)
		if c > ma:
			ma = c
			x = i
			yans = j
print('{} {}'.format(x + 1, yans + 1))


import sys

def read_input(input_path=None):
	if input_path is None:
		f = sys.stdin
	else:
		f = open(input_path, 'r')
	(n, k) = map(int, f.readline().split())
	field = list()
	for _ in range(n):
		field.append(f.readline().rstrip())
	return (n, k, field)

def sol(a, b, z):
	r = [[0] * a for _ in ' ' * a]
	c = [[0] * a for _ in ' ' * a]
	for i in range(a):
		for j in range(a - b + 1):
			ok = 1
			for k in range(b):
				if z[i][j + k] == '#':
					ok = 0
					break
			if ok:
				for k in range(b):
					r[i][j + k] += 1
			ok = 1
			for k in range(b):
				if z[j + k][i] == '#':
					ok = 0
					break
			if ok:
				for k in range(b):
					c[j + k][i] += 1
	(i1, j1) = (1, 1)
	ma = 0
	for i in range(a):
		for j in range(a):
			if c[i][j] + r[i][j] > ma:
				i1 = i + 1
				j1 = j + 1
				ma = c[i][j] + r[i][j]
	return [(i1, j1)]

def main():
	for ans in sol(*read_input()):
		print(f"{' '.join(map(str, ans))}")
		break
main()


(n, k) = [int(x) for x in input().split()]
m = []
for i in range(n):
	m.append(list(input()))
for i in range(n):
	for j in range(n):
		if m[i][j] == '.':
			m[i][j] = 1
		else:
			m[i][j] = -1
for i in range(n):
	for j in range(n):
		if m[i][j] >= 1:
			flag = 0
			if n - i >= k:
				for w in range(i, i + k):
					if m[w][j] == -1:
						flag = 1
						break
				if flag == 0:
					for w in range(i, i + k):
						m[w][j] += 1
			flag = 0
			if n - j >= k:
				for w in range(j, j + k):
					if m[i][w] == -1:
						flag = 1
						break
				if flag == 0:
					for w in range(j, j + k):
						m[i][w] += 1
ans = -1
for i in range(n):
	for j in range(n):
		if m[i][j] > ans:
			ans = m[i][j]
			r = i + 1
			c = j + 1
if ans == -1:
	print(1, 1)
	exit()
print(r, c)


(n, k) = map(int, input().split())
mat = []
ans = [[0] * n for _ in range(n)]
for i in range(n):
	mat.append(input())
for i in range(n):
	for j in range(n):
		if mat[i][j] == '.':
			flag = True
			for x in range(i, i + k):
				if x >= n or mat[x][j] == '#':
					flag = False
					break
			if flag:
				for x in range(i, i + k):
					ans[x][j] += 1
			flag = True
			for x in range(j, j + k):
				if x >= n or mat[i][x] == '#':
					flag = False
					break
			if flag:
				for x in range(j, j + k):
					ans[i][x] += 1
maxi = -1
row = 0
col = 0
for i in range(n):
	for j in range(n):
		if ans[i][j] > maxi:
			maxi = ans[i][j]
			row = i
			col = j
print(row + 1, col + 1)


(n, k) = map(int, input().split())
f = [list(input()) for _ in range(n)]
ans = (1, 1)
r = [[0 for _ in range(n)] for _ in range(n)]
for i in range(n):
	for j in range(n):
		if f[i][j] == '#':
			r[i][j] = 0
		elif i == 0:
			r[i][j] = 1
		else:
			r[i][j] = r[i - 1][j] + 1
c = [[0 for _ in range(n)] for _ in range(n)]
for i in range(n):
	for j in range(n):
		if f[i][j] == '#':
			c[i][j] = 0
		elif j == 0:
			c[i][j] = 1
		else:
			c[i][j] = c[i][j - 1] + 1
s = [[0 for _ in range(n)] for _ in range(n)]
for i in range(n):
	for j in range(n):
		for l in range(k):
			if i + l < n and k <= r[i + l][j]:
				s[i][j] += 1
			if j + l < n and k <= c[i][j + l]:
				s[i][j] += 1
		if s[ans[0] - 1][ans[1] - 1] < s[i][j]:
			ans = (i + 1, j + 1)
print(' '.join(map(str, ans)))


s = list(map(int, input().split()))
(n, k) = (s[0], s[1])
cl = []
for i in range(n):
	cl.append(input())
mx = 0
res = (0, 0)
for i in range(n):
	for j in range(n):
		pos = 0
		while j - pos >= 0 and pos <= k - 1 and (cl[i][j - pos] == '.'):
			pos += 1
		a = j - pos
		pos = 0
		while j + pos < n and pos <= k - 1 and (cl[i][j + pos] == '.'):
			pos += 1
		b = j + pos
		pos = 0
		while i - pos >= 0 and pos <= k - 1 and (cl[i - pos][j] == '.'):
			pos += 1
		c = i - pos
		pos = 0
		while i + pos < n and pos <= k - 1 and (cl[i + pos][j] == '.'):
			pos += 1
		d = i + pos
		x = b - a
		y = d - c
		e1 = 0
		e2 = 0
		if x >= k:
			e1 = x - k
		if y >= k:
			e2 = y - k
		e = e1 + e2
		if e > mx:
			mx = e
			res = (i, j)
print('{} {}'.format(res[0] + 1, res[1] + 1))


import sys
inp = sys.stdin.readlines()
(n, k) = [int(x) for x in inp[0].strip().split()]
g = []
for i in range(1, len(inp)):
	g.append(inp[i].strip())
ans = -1
ans_x = -1
ans_y = -1
for x in range(n):
	for y in range(n):
		a = 0
		if g[x][y] != '#':
			cnt = 0
			for i in range(k):
				if x - i < 0 or g[x - i][y] == '#':
					cnt += 1
			for i in range(k):
				if cnt == 0:
					a += 1
				if i == k - 1:
					break
				if x - k + 1 + i < 0 or g[x - k + 1 + i][y] == '#':
					cnt -= 1
				if x + i + 1 >= n or g[x + i + 1][y] == '#':
					cnt += 1
			cnt = 0
			for i in range(k):
				if y - i < 0 or g[x][y - i] == '#':
					cnt += 1
			for i in range(k):
				if cnt == 0:
					a += 1
				if i == k - 1:
					break
				if y - k + 1 + i < 0 or g[x][y - k + 1 + i] == '#':
					cnt -= 1
				if y + i + 1 >= n or g[x][y + i + 1] == '#':
					cnt += 1
		if a > ans:
			ans = a
			ans_x = x
			ans_y = y
print(ans_x + 1, ans_y + 1)


(n, m) = (int(i) for i in input().split())
result = [[0 for i in range(n)] for j in range(n)]
p = []
for i in range(n):
	p += [input()]
for i in range(n):
	for j in range(n - m + 1):
		flag = True
		for k in range(m):
			if p[i][j + k] == '#':
				flag = False
		if flag:
			for k in range(m):
				result[i][j + k] += 1
for i in range(n):
	for j in range(n - m + 1):
		flag = True
		for k in range(m):
			if p[j + k][i] == '#':
				flag = False
		if flag:
			for k in range(m):
				result[j + k][i] += 1
max_p = -1
res = [-1, -1]
for i in range(n):
	for j in range(n):
		if result[i][j] > max_p:
			max_p = result[i][j]
			res[0] = i + 1
			res[1] = j + 1
print(*res)


a = input()
a = a.split(' ')
for i in range(len(a)):
	a[i] = int(a[i])
d = []
for i in range(a[0]):
	c = input()
	d += [c]
b = []
n = a[0]
k = a[1]
for i in range(n):
	for j in range(n):
		if d[i][j] == '#':
			b += [0]
		else:
			x = 1
			y = 1
			for k in range(j + 1, min(n, a[1] + j)):
				if d[i][k] == '.':
					x += 1
				else:
					break
			for k in range(j - 1, max(-1, j - a[1]), -1):
				if d[i][k] == '.':
					x += 1
				else:
					break
			for k in range(i + 1, min(n, a[1] + i)):
				if d[k][j] == '.':
					y += 1
				else:
					break
			for k in range(i - 1, max(-1, i - a[1]), -1):
				if d[k][j] == '.':
					y += 1
				else:
					break
			b += [max(x - a[1] + 1, 0) + max(y - a[1] + 1, 0)]
c = max(b)
for i in range(len(b)):
	if b[i] == c:
		z = [i // n + 1, i % n + 1]
		break
print(z[0], z[1])


(n, k) = map(int, input().split())
l = []
for i in range(n):
	s = input()
	l.append(s)
d = {}
for i in range(n):
	for j in range(n):
		d.update({(i + 1, j + 1): 0})
(temp, index, f1, f2) = ([], 0, False, False)
for i in range(n):
	f = ''
	for j in range(n):
		f = f + l[j][index]
	index += 1
	temp.append(f)
for i in range(n):
	for j in range(n - k + 1):
		x = l[i][j:j + k]
		y = temp[i][j:j + k]
		if len(set(x)) == 1 and x[0] == '.':
			f1 = True
			for m in range(j, j + k):
				d[i + 1, m + 1] += 1
		if len(set(y)) == 1 and y[0] == '.':
			f2 = True
			for m in range(j, j + k):
				d[m + 1, i + 1] += 1
(m, point) = (d[1, 1], (1, 1))
for i in range(1, n + 1):
	for j in range(1, n + 1):
		t = (i, j)
		if d[t] > m:
			m = d[t]
			point = (i, j)
p = list(point)
if f1 or f2:
	print(p[0], p[1])
else:
	print(n, n)


def CheckHorizon(i, j):
	global n, k, field, cnt
	if j + k - 1 > n - 1:
		return
	for c in field[i][j:j + k]:
		if c == '#':
			return
	for c in range(j, j + k):
		cnt[i][c] += 1

def CheckVertical(i, j):
	global n, k, field, cnt
	if i + k - 1 > n - 1:
		return
	for c in range(i, i + k):
		if field[c][j] == '#':
			return
	for c in range(i, i + k):
		cnt[c][j] += 1
(n, k) = map(int, input().split())
field = [0] * n
for i in range(n):
	field[i] = list(input())
cnt = [[0] * (n + 1) for i in range(n + 1)]
(ansi, ansj) = (1, 1)
maxVal = 0
for i in range(n):
	for j in range(n):
		CheckHorizon(i, j)
		if k > 1:
			CheckVertical(i, j)
for i in range(n):
	for j in range(n):
		if cnt[i][j] > maxVal:
			maxVal = cnt[i][j]
			(ansi, ansj) = (i + 1, j + 1)
print(ansi, ansj)


import sys
import math
(n, k) = list(map(int, sys.stdin.readline().strip().split(' ')))
grid = []
for n0 in range(n):
	grid.append([char for char in sys.stdin.readline().strip()])
res = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
	for j in range(n):
		if grid[i][j] == '#':
			continue
		(ii, jj) = (i, j)
		cpt = 0
		while ii < n and cpt < k:
			if grid[ii][j] == '#':
				break
			else:
				cpt += 1
			ii += 1
		if cpt == k:
			for ii in range(i, i + k):
				res[ii][j] += 1
		cpt = 0
		while jj < n and cpt < k:
			if grid[i][jj] == '#':
				break
			else:
				cpt += 1
			jj += 1
		if cpt == k:
			for jj in range(j, j + k):
				res[i][jj] += 1
ans = [0, 0]
maxsf = -1
for i in range(n):
	for j in range(n):
		if res[i][j] > maxsf:
			ans = [i, j]
			maxsf = res[i][j]
print(ans[0] + 1, ans[1] + 1)


(n, k) = map(int, input().split())
occupied_cells = []
positions = []
for _ in range(n):
	positions.append([i for i in input()])
	occupied_cells.append([0] * n)
for row in range(n):
	for column in range(n):
		if positions[row][column] == '.':
			column2 = column
			k2 = k
			good_cells = []
			while k2 != 0 and column2 < n and (len(good_cells) != k):
				if positions[row][column2] == '.':
					good_cells.append([row, column2])
					k2 -= 1
					column2 += 1
				else:
					break
			if len(good_cells) == k:
				for cell in good_cells:
					occupied_cells[cell[0]][cell[1]] += 1
for column in range(n):
	for row in range(n):
		if positions[row][column] == '.':
			row2 = row
			k2 = k
			good_cells = []
			while k2 != 0 and row2 < n and (len(good_cells) != k):
				if positions[row2][column] == '.':
					good_cells.append([row2, column])
					k2 -= 1
					row2 += 1
				else:
					break
			if len(good_cells) == k:
				for cell in good_cells:
					occupied_cells[cell[0]][cell[1]] += 1
max_points = 0
coordinates = [1, 1]
for row in range(n):
	for column in range(n):
		if occupied_cells[row][column] > max_points:
			max_points = occupied_cells[row][column]
			coordinates = [row + 1, column + 1]
print(*coordinates)


(n, k) = map(int, input().split())
mapp = [list(input()) for i in range(n)]
res = 0
res = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
	count = 0
	for j in range(n):
		if mapp[i][j] == '.':
			count += 1
		else:
			count = 0
		if count >= k:
			for t in range(j - k + 1, j + 1):
				res[i][t] += 1
for i in range(n):
	count = 0
	for j in range(n):
		if mapp[j][i] == '.':
			count += 1
		else:
			count = 0
		if count >= k:
			for t in range(j - k + 1, j + 1):
				res[t][i] += 1
ress = [0, 0]
maxx = -1
for i in range(n):
	for j in range(n):
		if maxx < res[i][j]:
			maxx = res[i][j]
			(ress[0], ress[1]) = (i + 1, j + 1)
print(*ress)