'''
1
7
.......
.*.....
.......
.......
.......
.......
.......
'''

t = int(raw_input())
for i in range(t):
	n = int(raw_input())
	half = n/2
	ind = 0
	for j in range(n):
		a = raw_input()
		try:
			f = a.index('*')
			s = abs(half - ind) + abs(half - f)
		except:
			pass
		ind += 1
	print(s)