#include <bits/stdc++.h>
using namespace std;
bool B[101][101];
int n, m;
string s;
vector<pair<int, int> > Black;
bool ok(pair<int, int> a, pair<int, int> b) {
  for (int second = min(a.second, b.second); second <= max(a.second, b.second);
       ++second)
    if (!B[a.first][second]) return 0;
  for (int first = min(a.first, b.first); first <= max(a.first, b.first);
       ++first)
    if (!B[first][b.second]) return 0;
  return 1;
}
bool check() {
  for (int i = 0; i < Black.size(); ++i)
    for (int j = 0; j < Black.size(); ++j)
      if ((!ok(Black[i], Black[j])) && (!ok(Black[j], Black[i]))) return 0;
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    for (int j = 0; j < m; ++j)
      if (s[j] == 'B') {
        B[i][j] = 1;
        Black.push_back(make_pair(i, j));
      }
  }
  cout << (check() ? "YES\n" : "NO\n");
}
