tc = input()
for i in range(tc):
	n = input()
	size = (n+1)/2
	for x in range(n):
		r = raw_input()
		for y in range(n):
			if r[y] == '*':
				x=x+1
				y=y+1
				pos= abs(x-size)+abs(y-size)
				print pos