#-------------------------------------------------------------------------------
def loadInput():

    n  = int(raw_input())
    x_start, y_start = -1, -1
    for i in range(n):
        line = raw_input()
        for j in range(len(line)):
            if line[j] == '*':
                x_start = i
                y_start = j

    return (n, x_start, y_start)

def main():
    tc = int(raw_input())
    while tc > 0:
        tc -= 1
        (n, x_start, y_start) = loadInput()

        steps = abs(n/2 - x_start) + abs(n/2 - y_start)

        print steps

if __name__ == '__main__':
    main()