#include <bits/stdc++.h>
using namespace std;
int i, j, a, b, cnt = 0;
char temp;
vector<vector<int> > x;
bool is_w(pair<int, int> x1, pair<int, int> x2) {
  int ret_1 = 1, ret_2 = 1;
  for (int i = min(x1.first, x2.first); i <= max(x1.first, x2.first); ++i) {
    if (x[i][x1.second] == 0) {
      ret_1 = 0;
    }
    if (x[i][x2.second] == 0) {
      ret_2 = 0;
    }
  }
  for (int i = min(x1.second, x2.second); i <= max(x1.second, x2.second); ++i) {
    if (x[x1.first][i] == 0) ret_2 = 0;
    if (x[x2.first][i] == 0) ret_1 = 0;
  }
  return ret_1 || ret_2;
}
int main() {
  int result = 1;
  scanf("%d %d", &a, &b);
  x = vector<vector<int> >(a, vector<int>(b, 1));
  vector<pair<int, int> > bl;
  for (i = 0; i < a; ++i) {
    for (j = 0; j < b; ++j) {
      cin >> temp;
      if (temp == 'W') {
        x[i][j] = 0;
      }
      if (temp == 'B') {
        bl.push_back(pair<int, int>(i, j));
        cnt++;
        x[i][j] = 1;
      }
    }
  }
  for (i = 0; i < (int)bl.size(); ++i) {
    for (j = i + 1; j < (int)bl.size(); ++j) result *= is_w(bl[i], bl[j]);
  }
  if (result)
    printf("YES");
  else
    printf("NO");
  return 0;
}
