for i in range(input()):
	l1=[]
	for j in range(input()):
		a=raw_input()
		l1.append(a)
	for m in range(0,len(l1)):
		for n in range(0,len(l1)):
			if(l1[m][n]=="*"):
				b=m+1
				c=n+1
	d=(len(l1)+1)/2
	print(abs(d-b)+abs(d-c))