def error():
	exit(1)
t = input()
T = t if 1<=t<=50 else error()
for t in xrange(T):
	n = input()
	N = n if n%2 == 1 else error()
	M = []
	mid = N/2 + 1
	#print N
	for i in xrange(N):
		#print i
		M.append(list(raw_input()))
		#print M[i]
	
	#print M
	#X,Y = -1,-1 
	for i in xrange(N):
		for j in xrange(N):
			#print M[i][j]
			if M[i][j] == "*":
				X = i+1
				Y = j+1
				break
	
	#if X and Y:
	#print X,Y
	print abs(mid -X) + abs(mid - Y)