#include <bits/stdc++.h>
using namespace std;
string x[50];
vector<int> vis[50], v2[50];
int dx[] = {1, 0, 0, -1};
int dy[] = {0, -1, 1, 0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m, i, j;
  cin >> n >> m;
  for (i = 0; i < 50; i++) {
    vis[i].resize(50);
    v2[i].resize(50);
  }
  for (i = 0; i < n; i++) cin >> x[i];
  set<pair<int, int> > blk, bb;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (x[i][j] == 'B') vis[i][j] = 1;
  for (int li = 0; li < n; li++)
    for (int lj = 0; lj < m; lj++)
      if (x[li][lj] == 'B') {
        for (i = 0; i < n; i++)
          for (j = 0; j < m; j++) v2[i][j] = vis[i][j];
        for (i = 0; i < 4; i++) {
          int cx = li;
          int cy = lj;
          int nx = cx;
          int ny = cy;
          while (nx >= 0 && nx < n && ny >= 0 && ny < m && x[nx][ny] == 'B') {
            for (j = 0; j < 4; j++) {
              int lx, ly;
              lx = nx;
              ly = ny;
              while (lx >= 0 && lx < n && ly >= 0 && ly < m &&
                     x[lx][ly] == 'B') {
                v2[lx][ly] = 0;
                lx += dx[j];
                ly += dy[j];
              }
            }
            nx += dx[i];
            ny += dy[i];
          }
        }
        for (i = 0; i < n; i++)
          for (j = 0; j < m; j++)
            if (v2[i][j]) return 0 * puts("NO");
      }
  return 0 * puts("YES");
}
