#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m, i, j, k;
  cin >> n >> m;
  vector<pair<long long, long long> > v;
  char arr[n + 4][m + 4];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cin >> arr[i][j];
      if (arr[i][j] == 'B') {
        v.push_back({i, j});
      }
    }
  }
  bool flag = true;
  for (auto it : v) {
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        if (i == it.first && j == it.second) {
          continue;
        }
        if (arr[i][j] == 'B') {
          if (i < it.first && j == it.second) {
            for (k = it.first - 1; k >= i; k--) {
              if (arr[k][j] == 'W') {
                flag = false;
                break;
              }
            }
          } else if (i > it.first && j == it.second) {
            for (k = it.first + 1; k <= i; k++) {
              if (arr[k][j] == 'W') {
                flag = false;
                break;
              }
            }
          } else if (i == it.first && j < it.second) {
            for (k = it.second - 1; k >= j; k--) {
              if (arr[i][k] == 'W') {
                flag = false;
                break;
              }
            }
          } else if (i == it.first && j > it.second) {
            for (k = it.second + 1; k <= j; k++) {
              if (arr[i][k] == 'W') {
                flag = false;
                break;
              }
            }
          } else if (i < it.first && j < it.second) {
            long long two = 2, tw = 2;
            for (k = it.second - 1; k >= j; k--) {
              if (arr[it.first][k] == 'W') {
                two--;
                break;
              }
            }
            for (k = it.first - 1; k >= i; k--) {
              if (arr[k][j] == 'W') {
                two--;
                break;
              }
            }
            for (k = it.first - 1; k >= i; k--) {
              if (arr[k][it.second] == 'W') {
                tw--;
                break;
              }
            }
            for (k = it.second - 1; k >= j; k--) {
              if (arr[i][k] == 'W') {
                tw--;
                break;
              }
            }
            if (tw < 2 && two < 2) {
              flag = false;
              break;
            }
          } else if (i < it.first && j > it.second) {
            long long two = 2, tw = 2;
            for (k = it.second + 1; k <= j; k++) {
              if (arr[it.first][k] == 'W') {
                two--;
                break;
              }
            }
            for (k = it.first - 1; k >= i; k--) {
              if (arr[k][j] == 'W') {
                two--;
                break;
              }
            }
            for (k = it.first - 1; k >= i; k--) {
              if (arr[k][it.second] == 'W') {
                tw--;
                break;
              }
            }
            for (k = it.second + 1; k <= j; k++) {
              if (arr[i][k] == 'W') {
                tw--;
                break;
              }
            }
            if (tw < 2 && two < 2) {
              flag = false;
              break;
            }
          } else if (i > it.first && j < it.second) {
            long long two = 2, tw = 2;
            for (k = it.second - 1; k >= j; k--) {
              if (arr[it.first][k] == 'W') {
                two--;
                break;
              }
            }
            for (k = it.first + 1; k <= i; k++) {
              if (arr[k][j] == 'W') {
                two--;
                break;
              }
            }
            for (k = it.first + 1; k <= i; k++) {
              if (arr[k][it.second] == 'W') {
                tw--;
                break;
              }
            }
            for (k = it.second - 1; k <= j; k++) {
              if (arr[i][k] == 'W') {
                tw--;
                break;
              }
            }
            if (tw < 2 && two < 2) {
              flag = false;
              break;
            }
          } else {
            long long two = 2, tw = 2;
            for (k = it.first + 1; k <= i; k++) {
              if (arr[k][it.second] == 'W') {
                two--;
                break;
              }
            }
            for (k = it.second + 1; k <= j; k++) {
              if (arr[i][k] == 'W') {
                two--;
                break;
              }
            }
            for (k = it.second + 1; k <= j; k++) {
              if (arr[it.first][k] == 'W') {
                tw--;
                break;
              }
            }
            for (k = it.first + 1; k <= i; k++) {
              if (arr[k][j] == 'W') {
                tw--;
                break;
              }
            }
            if (tw < 2 && two < 2) {
              flag = false;
              break;
            }
          }
        }
        if (flag == false) {
          break;
        }
      }
      if (flag == false) {
        break;
      }
    }
  }
  if (flag) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
