#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T b, T p, T m) {
  T ret;
  if (p == 0) return 1;
  if (p & 1) {
    ret = (bigmod(b, p / 2, m) % m);
    return ((b % m) * ret * ret) % m;
  } else {
    ret = (bigmod(b, p / 2, m) % m);
    return (ret * ret) % m;
  }
}
int dx4[] = {1, -1, 0, 0};
int dy4[] = {0, 0, 1, -1};
int dx6[] = {0, 0, 1, -1, 0, 0};
int dy6[] = {1, -1, 0, 0, 0, 0};
int dz6[] = {0, 0, 0, 0, 1, -1};
int dx8[] = {1, -1, 0, 0, -1, 1, -1, 1};
int dy8[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dkx8[] = {-1, 1, -1, 1, -2, -2, 2, 2};
int dky8[] = {2, 2, -2, -2, 1, -1, 1, -1};
int tc = 1;
const double eps = 1e-9;
const double pi = acos(-1.0);
const long long int mx = 1e5;
const long long int mod = 1e9 + 7;
char ar[100][100];
long n, m, fl, fl1, tfl;
long lx, ly, rx, ry, qx, qy;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cin >> ar[i][j];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int i1 = i; i1 <= n; i1++) {
        for (int j1 = 1; j1 <= m; j1++) {
          if (ar[i][j] == 'B' && ar[i1][j1] == 'B') {
            lx = i;
            rx = i1;
            ly = j;
            ry = j1;
            fl = 0;
            fl1 = 0;
            long dx, dy;
            if (ry > ly)
              dy = 1;
            else
              dy = -1;
            if (rx > lx)
              dx = 1;
            else
              dx = -1;
            qx = lx;
            qy = ly;
            while (qx != rx) {
              qx += dx;
              if (ar[qx][qy] == 'W') fl = 1;
            }
            while (qy != ry) {
              qy += dy;
              if (ar[qx][qy] == 'W') fl = 1;
            }
            qx = lx;
            qy = ly;
            while (qy != ry) {
              qy += dy;
              if (ar[qx][qy] == 'W') fl1 = 1;
            }
            while (qx != rx) {
              qx += dx;
              if (ar[qx][qy] == 'W') fl1 = 1;
            }
            if (fl > 0 && fl1 > 0) {
              tfl = 1;
              break;
            }
          }
        }
      }
    }
  }
  if (tfl)
    cout << "NO"
         << "\n";
  else
    cout << "YES"
         << "\n";
  cin.get();
  return 0;
}
