def to_matrix(l, n):
    return [l[i:i+n] for i in xrange(0, len(l), n)]

def find(l, elem):
    for row, i in enumerate(l):
        try:
            column = i.index(elem)
        except ValueError:
            continue
        return row, column
    return -1

t=int(raw_input())
for w in range(t):
    n=int(raw_input())
    a=[]
    b=[]
    for i in range(n):
        b.append(raw_input())
    for i in b:
        for j in i:
            a.append(j)
    matrix=to_matrix(a,n)
    cnt=0
    center=(n-1)/2
    x,y=find(matrix,'*')
    print abs(x-center)+abs(y-center)