#include <bits/stdc++.h>
using namespace std;
char a[101][101];
bool funk(int x, int y, int x1, int y1) {
  int x2 = x;
  int y2 = y;
  bool ok = 1;
  while (1) {
    if (x1 == x2) {
      if (y1 == y2)
        break;
      else {
        if (y1 > y2)
          y2++;
        else
          y2--;
      }
    } else {
      if (x1 > x2)
        x2++;
      else
        x2--;
    }
    if (a[x2][y2] != 'B') ok = 0;
  }
  if (ok) return 1;
  ok = 1;
  x2 = x;
  y2 = y;
  while (1) {
    if (y1 == y2) {
      if (x1 == x2)
        break;
      else {
        if (x1 > x2)
          x2++;
        else
          x2--;
      }
    } else {
      if (y1 > y2)
        y2++;
      else
        y2--;
    }
    if (a[x2][y2] != 'B') ok = 0;
  }
  if (ok) return 1;
  return 0;
}
int main() {
  int i, j, n, m, i1, j1;
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) cin >> a[i][j];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      for (i1 = 1; i1 <= n; i1++) {
        for (j1 = 1; j1 <= m; j1++) {
          if (a[i][j] == 'B' && a[i1][j1] == 'B' && !funk(i, j, i1, j1)) {
            cout << "NO";
            return 0;
          }
        }
      }
    }
  }
  cout << "YES";
  return 0;
}
