#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:300000000")
const long double eps = 1e-20;
const long double pi = acos(-1.0);
const long long inf = 1000 * 1000 * 1000 * 1000 * 1000 * 1000;
const long long base = 1000 * 1000 * 1000 + 7;
using namespace std;
bool a[111][111];
bool ans = true;
int n, m;
string s[111];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (n); i++) cin >> s[i];
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (m); j++) a[i][j] = (s[i][j] == 'B');
  for (int x1 = 0; x1 < (n); x1++)
    for (int y1 = 0; y1 < (m); y1++)
      for (int x2 = 0; x2 < (n); x2++)
        for (int y2 = 0; y2 < (m); y2++)
          if (a[x1][y1] && a[x2][y2]) {
            int xx = x1, yy = y2;
            bool ok1 = true, ok2 = true;
            for (int o = (min(x1, x2)); o <= (max(x1, x2)); o++)
              if (!a[o][yy]) ok1 = false;
            for (int o = (min(y1, y2)); o <= (max(y1, y2)); o++)
              if (!a[xx][o]) ok2 = false;
            if (ok1 && ok2) continue;
            xx = x2;
            yy = y1;
            ok1 = true;
            ok2 = true;
            for (int o = (min(x1, x2)); o <= (max(x1, x2)); o++)
              if (!a[o][yy]) ok1 = false;
            for (int o = (min(y1, y2)); o <= (max(y1, y2)); o++)
              if (!a[xx][o]) ok2 = false;
            if (ok1 && ok2) continue;
            ans = false;
          }
  if (!ans)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
