#include <bits/stdc++.h>
using namespace std;
template <typename... T>
inline void inp(T &...args) {
  ((cin >> args), ...);
}
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
  for (auto &x : a) in >> x;
  return in;
}
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T, U> &a) {
  in >> a.first >> a.second;
  return in;
}
const long long int mx = 100;
long long int n, m;
string a[mx];
bool vis[mx][mx];
const vector<int> dx = {1, -1, 0, 0, 1, -1, 1, -1};
const vector<int> dy = {0, 0, 1, -1, 1, -1, -1, 1};
bool ok(long long int x, long long int y, long long int N, long long int M) {
  return (x >= 0 and x < N and y >= 0 and y < M and a[x][y] == 'B' and
          !vis[x][y]);
}
void dfs(long long int i, long long int j) {
  vis[i][j] = 1;
  for (long long int k = (0); ((1) > 0 ? k < (4) : k > (4)); k += (1)) {
    long long int x = i + dx[k];
    long long int y = j + dy[k];
    if (ok(x, y, n, m)) {
      dfs(x, y);
    }
  }
}
void solve(int &T) {
  cin >> n >> m;
  for (long long int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1))
    cin >> a[i];
  for (long long int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1))
    for (long long int j = (0); ((1) > 0 ? j < (m) : j > (m)); j += (1))
      vis[i][j] = 0;
  long long int cc = 0;
  vector<pair<long long int, long long int>> b;
  for (long long int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1)) {
    for (long long int j = (0); ((1) > 0 ? j < (m) : j > (m)); j += (1)) {
      if (!vis[i][j] and a[i][j] == 'B') {
        cc++;
        dfs(i, j);
      }
      if (a[i][j] == 'B') {
        b.emplace_back(i, j);
      }
    }
  }
  11;
  if (cc > 1) {
    cout << "NO\n";
    return;
  }
  n = b.size();
  for (long long int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1)) {
    for (long long int j = (i + 1);
         (((i + 1) <= (n) ? 1 : -1) > 0 ? j < (n) : j > (n));
         j += ((i + 1) <= (n) ? 1 : -1)) {
      pair<long long int, long long int> s = min(b[i], b[j]);
      pair<long long int, long long int> e = max(b[i], b[j]);
      pair<long long int, long long int> m1 = {s.first, e.second};
      pair<long long int, long long int> m2 = {e.first, s.second};
      11;
      bool path1 = 1, path2 = 1;
      long long int x = s.second, y = m1.second;
      for (long long int k = (x);
           (((x) <= (y + 1) ? 1 : -1) > 0 ? k < (y + 1) : k > (y + 1));
           k += ((x) <= (y + 1) ? 1 : -1)) {
        if (a[s.first][k] != 'B') {
          path1 = 0;
          break;
        }
      }
      x = m1.first, y = e.first;
      for (long long int k = (x);
           (((x) <= (y + 1) ? 1 : -1) > 0 ? k < (y + 1) : k > (y + 1));
           k += ((x) <= (y + 1) ? 1 : -1)) {
        if (a[k][e.second] != 'B') {
          path1 = 0;
          break;
        }
      }
      x = s.first, y = m2.first;
      for (long long int k = (x);
           (((x) <= (y + 1) ? 1 : -1) > 0 ? k < (y + 1) : k > (y + 1));
           k += ((x) <= (y + 1) ? 1 : -1)) {
        if (a[k][s.second] != 'B') {
          path2 = 0;
          break;
        }
      }
      x = m2.second, y = e.second;
      for (long long int k = (x);
           (((x) <= (y + 1) ? 1 : -1) > 0 ? k < (y + 1) : k > (y + 1));
           k += ((x) <= (y + 1) ? 1 : -1)) {
        if (a[e.first][k] != 'B') {
          path2 = 0;
          break;
        }
      }
      if (path1 or path2) continue;
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    if (0) cerr << "Case #" << i << "\n";
    solve(i);
  }
  return 0;
}
