#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
struct SD {
  int x, y, c;
} p, pp;
int f[50000], bk[110][110];
int n, m, k, maxx, ans, cur, sum, x, y;
int minn;
int nex[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
char mapp[1100][1100];
queue<struct SD> q;
int bfs(int x, int y) {
  while (q.size()) q.pop();
  p.x = x, p.y = y, p.c = 0;
  q.push(p);
  ans = 1;
  memset(bk, 0, sizeof(bk));
  ;
  bk[x][y] = 1;
  while (q.size()) {
    p = q.front();
    q.pop();
    if (p.c > 1) return ans < sum;
    for (int i = p.x; i < n; i++) {
      if (mapp[i][p.y] == 'B') {
        if (bk[i][p.y]) continue;
        pp.x = i, pp.y = p.y, pp.c = p.c + 1;
        bk[pp.x][pp.y] = 1;
        ans++;
        q.push(pp);
      } else
        break;
    }
    for (int i = p.x; i >= 0; i--) {
      if (mapp[i][p.y] == 'B') {
        if (bk[i][p.y]) continue;
        ans++;
        pp.x = i, pp.y = p.y, pp.c = p.c + 1;
        bk[pp.x][pp.y] = 1;
        q.push(pp);
      } else
        break;
    }
    for (int i = p.y; i < m; i++) {
      if (mapp[p.x][i] == 'B') {
        if (bk[p.x][i]) continue;
        pp.x = p.x, pp.y = i, pp.c = p.c + 1;
        ans++;
        bk[pp.x][pp.y] = 1;
        q.push(pp);
      } else
        break;
    }
    for (int i = p.y; i >= 0; i--) {
      if (mapp[p.x][i] == 'B') {
        if (bk[p.x][i]) continue;
        pp.x = p.x, pp.y = i, pp.c = p.c + 1;
        ans++;
        bk[pp.x][pp.y] = 1;
        q.push(pp);
      } else
        break;
    }
  }
  return ans < sum;
}
int main() {
  while (cin >> n >> m) {
    cur = sum = 0;
    for (int i = 0; i < n; i++) scanf("%s", mapp[i]);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (mapp[i][j] == 'B') {
          sum++;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (mapp[i][j] == 'B') {
          if (bfs(i, j)) {
            cur = 1;
            break;
          }
        }
      }
      if (cur) break;
    }
    if (cur)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
