t = int(raw_input())

for tc in xrange(1, t+1):
	m = int(raw_input())
	mid = (m/2) + 1
	cnt = 0
	for row in xrange(1, m+1):
		a = raw_input()
		cnt += 1
		if '*' in a:
			cnt_row = cnt
			cnt_col = a.index('*') + 1
			
	n_row = abs(mid - cnt_row)
	n_col = abs(mid - cnt_col)
	print n_row+n_col