#include <bits/stdc++.h>
using namespace std;
void read_input(vector<string> &table,
                vector<pair<size_t, size_t> > &black_cells) {
  size_t n, m;
  cin >> n >> m;
  table.reserve(n);
  black_cells.reserve(n * m);
  for (size_t i = 0; i < n; ++i) {
    string s;
    cin >> s;
    table.push_back(s);
    for (size_t j = 0; j < s.size(); ++j)
      if (s[j] == 'B') black_cells.push_back(make_pair(i, j));
  }
  sort(black_cells.begin(), black_cells.end());
}
bool check_row(const vector<string> &table, size_t y1, size_t y2, size_t x) {
  for (size_t i = y1; i <= y2; ++i)
    if (table[x][i] == 'W') return false;
  return true;
}
bool check_column(const vector<string> &table, size_t x1, size_t x2, size_t y) {
  for (size_t i = x1; i <= x2; ++i)
    if (table[i][y] == 'W') return false;
  return true;
}
bool has_good_path(const vector<string> &table,
                   const vector<pair<size_t, size_t> > &black_cells, size_t s,
                   size_t t) {
  size_t x1 = black_cells[s].first;
  size_t x2 = black_cells[t].first;
  if (x1 > x2) swap(x1, x2);
  size_t y1 = black_cells[s].second;
  size_t y2 = black_cells[t].second;
  if (y1 > y2) swap(y1, y2);
  bool v[4] = {check_row(table, y1, y2, x1), check_column(table, x1, x2, y1),
               check_row(table, y1, y2, x2), check_column(table, x1, x2, y2)};
  for (int i = 0; i < 4; ++i)
    if (v[i] && v[(i + 1) % 4]) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  vector<string> table;
  vector<pair<size_t, size_t> > black_cells;
  read_input(table, black_cells);
  for (size_t i = 0; i < black_cells.size() - 1; ++i)
    for (size_t j = i + 1; j < black_cells.size(); ++j)
      if (!has_good_path(table, black_cells, i, j)) {
        cout << "NO" << endl;
        return false;
      }
  cout << "YES" << endl;
  return 0;
}
