t = int(raw_input())
for i in range(0, t):
    size = int(raw_input())
    middle = size//2 + 1
    star_row = 0
    star_col = 0
    for r in range(0, size):
        row = raw_input()
        if row.__contains__('*'):
            star_row = r
            star_col = row.index('*')
    steps = 0

    while star_row != middle-1:
        if star_row > middle-1:
            star_row -= 1
        else:
            star_row += 1
        steps += 1

    while star_col != middle-1:
        if star_col > middle-1:
            star_col -= 1
        else:
            star_col += 1
        steps += 1
    print steps