/*
        check korbo je amader oi grid e 1 er beshi black cell ase kina
                if no: Yes
                if yes:
                1) amader oi grid e por por 3ta consecutive
   cell ase kina jegula black
                if yes: no
                                if no:
 
  0 1 2
0 . # .
1 . # #
2 . . .
 
 
 
*/
 
#include <bits/stdc++.h>
using namespace std;
 
bool up_right_and_left_bottom(vector<vector<char>>& grid, int black_cell_cnt,
                              int first_black_cell_row,
                              int first_black_cell_col) {
  int count = 1;
  int n = grid.size();
 
  int i = first_black_cell_row;
  int j = first_black_cell_col;
 
  bool now_at_up = true;
  bool now_at_right = false;
 
  while (true) {
    if (now_at_up == true) {
      i--;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_up = false;
        now_at_right = true;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    } else if (now_at_right == true) {
      j++;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_up = true;
        now_at_right = false;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    }
  }
 
  i = first_black_cell_row;
  j = first_black_cell_col;
 
  bool now_at_left = true;
  bool now_at_bottom = false;
 
  while (true) {
    if (now_at_left == true) {
      j--;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_left = false;
        now_at_bottom = true;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    } else if (now_at_bottom == true) {
      i++;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_left = true;
        now_at_bottom = false;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    }
  }
 
  if (count == black_cell_cnt) {
    return true;
  } else {
    return false;
  }
}
 
bool right_top_and_bottom_left(vector<vector<char>>& grid, int black_cell_cnt,
                               int first_black_cell_row,
                               int first_black_cell_col) {
  int count = 1;
  int n = grid.size();
 
  int i = first_black_cell_row;
  int j = first_black_cell_col;
 
  bool now_at_right = true;
  bool now_at_top = false;
 
  while (true) {
    if (now_at_right == true) {
      j++;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_right = false;
        now_at_top = true;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    } else if (now_at_top == true) {
      i--;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_right = true;
        now_at_top = false;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    }
  }
 
  i = first_black_cell_row;
  j = first_black_cell_col;
 
  bool now_at_bottom = true;
  bool now_at_left = false;
 
  while (true) {
    if (now_at_bottom == true) {
      i++;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_bottom = false;
        now_at_left = true;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    } else if (now_at_left == true) {
      j--;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_bottom = true;
        now_at_left = false;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    }
  }
 
  if (count == black_cell_cnt) {
    return true;
  } else {
    return false;
  }
}
 
bool left_top_and_bottom_right(vector<vector<char>>& grid, int black_cell_cnt,
                               int first_black_cell_row,
                               int first_black_cell_col) {
  int count = 1;
  int n = grid.size();
 
  int i = first_black_cell_row;
  int j = first_black_cell_col;
 
  bool now_at_left = true;
  bool now_at_top = false;
 
  while (true) {
    if (now_at_left == true) {
      j--;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_left = false;
        now_at_top = true;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    } else if (now_at_top == true) {
      i--;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_left = true;
        now_at_top = false;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    }
  }
 
  i = first_black_cell_row;
  j = first_black_cell_col;
 
  bool now_at_bottom = true;
  bool now_at_right = false;
 
  while (true) {
    if (now_at_bottom == true) {
      i++;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_bottom = false;
        now_at_right = true;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    } else if (now_at_right == true) {
      j++;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_bottom = true;
        now_at_right = false;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    }
  }
 
  if (count == black_cell_cnt) {
    return true;
  } else {
    return false;
  }
}
 
bool up_left_and_right_bottom(vector<vector<char>>& grid, int black_cell_cnt,
                              int first_black_cell_row,
                              int first_black_cell_col) {
  int count = 1;
  int n = grid.size();
 
  int i = first_black_cell_row;
  int j = first_black_cell_col;
 
  bool now_at_up = true;
  bool now_at_left = false;
 
  while (true) {
    if (now_at_up == true) {
      i--;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_up = false;
        now_at_left = true;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    } else if (now_at_left == true) {
      j--;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_up = true;
        now_at_left = false;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    }
  }
 
  i = first_black_cell_row;
  j = first_black_cell_col;
 
  bool now_at_right = true;
  bool now_at_bottom = false;
 
  while (true) {
    if (now_at_right == true) {
      j++;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_right = false;
        now_at_bottom = true;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    } else if (now_at_bottom == true) {
      i++;
      if (i >= 0 && i < n && j >= 0 && j < n) {
        now_at_right = true;
        now_at_bottom = false;
        if (grid[i][j] == '#') {
          count++;
        }
      } else {
        break;
      }
    }
  }
 
  if (count == black_cell_cnt) {
    return true;
  } else {
    return false;
  }
}
 
void solve() {
  int n;
  cin >> n;
  vector<vector<char>> grid(n);
 
  int first_black_cell_row = -1;
  int first_black_cell_col = -1;
 
  int black_cell_cnt = 0;
 
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      char x;
      cin >> x;
      grid[i].push_back(x);
 
      if (grid[i][j] == '#') {
        black_cell_cnt++;
      }
      if (grid[i][j] == '#' && first_black_cell_row == -1 &&
          first_black_cell_col == -1) {
        first_black_cell_row = i;
        first_black_cell_col = j;
      }
    }
  }
 
  if (black_cell_cnt < 2 || n <= 2) {
    cout << "YES" << endl;
  } else {
    // check three consecutive cell black or not;
    bool is_there_consecutive_cell_black = false;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n - 2; ++j) {
        if (grid[i][j] == '#' && grid[i][j + 1] == '#' &&
            grid[i][j + 2] == '#') {
          is_there_consecutive_cell_black = true;
          break;
        }
      }
    }
    if (is_there_consecutive_cell_black != true) {
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n - 2; ++j) {
          if (grid[j][i] == '#' && grid[j + 1][i] == '#' &&
              grid[j + 2][i] == '#') {
            is_there_consecutive_cell_black = true;
            break;
          }
        }
        if (is_there_consecutive_cell_black) break;
      }
    }
 
    if (is_there_consecutive_cell_black) {
      cout << "NO" << endl;
    } else {
      if (up_right_and_left_bottom(grid, black_cell_cnt, first_black_cell_row,
                                   first_black_cell_col) == true ||
          right_top_and_bottom_left(grid, black_cell_cnt, first_black_cell_row,
                                    first_black_cell_col) == true ||
          up_left_and_right_bottom(grid, black_cell_cnt, first_black_cell_row,
                                   first_black_cell_col) == true ||
          left_top_and_bottom_right(grid, black_cell_cnt, first_black_cell_row,
                                    first_black_cell_col) == true) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
  }
}
 
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}