#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
int n, m;
bool was[100][100];
char a[100][100];
void go(int x, int y, int t1, int t2, int k) {
  if (k == 2) {
    return;
  }
  while (x > 0 && y > 0 && x <= n && y <= m && a[x][y] != 'W') {
    x += t1;
    y += t2;
    if (t1 == 0) {
      go(x, y, 1, 0, k + 1);
      go(x, y, -1, 0, k + 1);
    } else {
      go(x, y, 0, -1, k + 1);
      go(x, y, 0, 1, k + 1);
    }
    if (a[x][y] == 'B') {
      was[x][y] = true;
    }
  }
}
int main() {
  srand(time(NULL));
  cin >> n >> m;
  int o = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'B') {
        o++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] != 'B') continue;
      was[i][j] = true;
      go(i, j, 1, 0, 0);
      go(i, j, -1, 0, 0);
      go(i, j, 0, -1, 0);
      go(i, j, 0, 1, 0);
      for (int t1 = 1; t1 <= n; t1++) {
        for (int t2 = 1; t2 <= m; t2++) {
          if (!was[t1][t2] && a[t1][t2] == 'B') {
            cout << "NO";
            return 0;
          }
          was[t1][t2] = false;
        }
      }
    }
  }
  cout << "YES";
  return 0;
}
