#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1}, dy[] = {-1, 1, 0, 0, 1, -1, -1, 1};
void run();
int main() {
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(16);
  run();
}
int n, m;
char grid[100][100];
bool path1(int i1, int j1, int i2, int j2) {
  while (j1 != j2) {
    j1 += j1 < j2 ? 1 : -1;
    if (grid[i1][j1] != 'B') return 0;
  }
  while (i1 != i2) {
    i1 += i1 < i2 ? 1 : -1;
    if (grid[i1][j1] != 'B') return 0;
  }
  return 1;
}
bool path2(int i1, int j1, int i2, int j2) {
  while (i1 != i2) {
    i1 += i1 < i2 ? 1 : -1;
    if (grid[i1][j1] != 'B') return 0;
  }
  while (j1 != j2) {
    j1 += j1 < j2 ? 1 : -1;
    if (grid[i1][j1] != 'B') return 0;
  }
  return 1;
}
void run() {
  cin >> n >> m;
  for (int i = (0); i < (n); ++i) cin >> grid[i];
  for (int i1 = (0); i1 < (n); ++i1)
    for (int j1 = (0); j1 < (m); ++j1)
      for (int i2 = (0); i2 < (n); ++i2)
        for (int j2 = (0); j2 < (m); ++j2) {
          if (grid[i1][j1] != 'B') continue;
          if (grid[i2][j2] != 'B') continue;
          if (!path1(i1, j1, i2, j2) && !path2(i1, j1, i2, j2)) {
            cout << "NO"
                 << "\n";
            return;
          }
        }
  cout << "YES"
       << "\n";
}
