public void solve() throws IOException {
    int n = nextInt();
    char[][] arr = new char[n][n];

    for (int x = 0; x < n; x++) {
      arr[x] = nextLine().toCharArray();
    }

    for (int x = 0; x < n; x++) {
      for (int y = 0; y < n; y++) {
        if (!checkCell(arr, x, y)) {
          System.out.println("NO");
          return;
        }
      }
    }
    System.out.println("YES");
  }