#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
int n, m;
string str[100];
void invalid(pair<int, int> a, pair<int, int> b) {
  cout << "NO" << endl;
  exit(0);
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) cin >> str[i];
  vector<pair<int, int> > arr;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (str[i][j] == 'B') {
        arr.push_back(make_pair(i, j));
      }
    }
  }
  for (int i = 0; i + 1 < arr.size(); i++) {
    for (int j = i + 1; j < arr.size(); j++) {
      if (arr[i].first == arr[j].first) {
        for (int k = arr[i].second; k <= arr[j].second; k++) {
          if (str[arr[i].first][k] == 'W') invalid(arr[i], arr[j]);
        }
      } else if (arr[i].second == arr[j].second) {
        for (int k = arr[i].first; k <= arr[j].first; k++) {
          if (str[k][arr[i].second] == 'W') invalid(arr[i], arr[j]);
        }
      } else {
        if (arr[i].second > arr[j].second) {
          int flag = 1;
          for (int k = arr[i].first; k <= arr[j].first; k++) {
            if (str[k][arr[i].second] == 'W') flag = 0;
          }
          for (int k = arr[j].second; k <= arr[i].second; k++) {
            if (str[arr[j].first][k] == 'W') flag = 0;
          }
          if (flag == 1) continue;
          flag = 1;
          for (int k = arr[j].second; k <= arr[i].second; k++) {
            if (str[arr[i].first][k] == 'W') flag = 0;
          }
          for (int k = arr[i].first; k <= arr[j].first; k++) {
            if (str[k][arr[j].second] == 'W') flag = 0;
          }
          if (flag == 0) invalid(arr[i], arr[j]);
        } else {
          int flag = 1;
          for (int k = arr[i].first; k <= arr[j].first; k++) {
            if (str[k][arr[i].second] == 'W') flag = 0;
          }
          for (int k = arr[i].second; k <= arr[j].second; k++) {
            if (str[arr[j].first][k] == 'W') flag = 0;
          }
          if (flag == 1) continue;
          flag = 1;
          for (int k = arr[i].second; k <= arr[j].second; k++) {
            if (str[arr[i].first][k] == 'W') flag = 0;
          }
          for (int k = arr[i].first; k <= arr[j].first; k++) {
            if (str[k][arr[j].second] == 'W') flag = 0;
          }
          if (flag == 0) invalid(arr[i], arr[j]);
        }
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
