for i in range(int(raw_input())):
	cnt=int(raw_input())
	for j in range(cnt):
		row=list(raw_input())
		if '*' in row:
			y=row.index('*')
			mid=(cnt-1)/2
			ans=abs(j-mid)+abs(y-mid)
			print ans
			continue