#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 7;
const long long int INF = 1e18 + 7;
const long long int mod = 1e9 + 7;
bool used[100][100];
char ar[100][100];
bool usedNow[100][100];
void check(long long int x, long long int y) {
  if (used[x][y] == true || ar[x][y] != 'B') return;
  used[x][y] = true;
  check(x + 1, y);
  check(x - 1, y);
  check(x, y + 1);
  check(x, y - 1);
}
long long int n, m, a, b;
bool mainCheck(long long int x, long long int y) {
  long long int a = x, b = y;
  while (ar[a - 1][b] == 'B') a--;
  while (ar[a][b] == 'B') {
    while (ar[a][b - 1] == 'B') b--;
    while (ar[a][b] == 'B') {
      usedNow[a][b] = true;
      b++;
    }
    b = y;
    a++;
  }
  a = x, b = y;
  while (ar[a][b - 1] == 'B') b--;
  while (ar[a][b] == 'B') {
    while (ar[a - 1][b] == 'B') a--;
    while (ar[a][b] == 'B') {
      usedNow[a][b] = true;
      a++;
    }
    a = x;
    b++;
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (usedNow[i][j] != used[i][j]) {
        return false;
      }
    }
  }
  for (long long int i = 0; i < 100; i++) {
    for (long long int j = 0; j < 100; j++) {
      usedNow[i][j] = false;
    }
  }
  return true;
}
void solve1() {
  cin >> n >> m;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> ar[i][j];
      if (ar[i][j] == 'B') a = i, b = j;
    }
  }
  check(a, b);
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (ar[i][j] == 'B' && !used[i][j]) {
        cout << "NO";
        return;
      }
    }
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (ar[i][j] == 'B' && !mainCheck(i, j)) {
        cout << "NO";
        return;
      }
    }
  }
  cout << "YES";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand(time(0));
  long long int cghf = 1;
  while (cghf--) {
    solve1();
  }
}
