#include <bits/stdc++.h>
using namespace std;
void prllv(vector<long long int> v) {
  long long int sz = v.size();
  for (long long int i = 0; i < sz; i++) {
    if (i == sz - 1)
      cout << v[i] << "\n";
    else
      cout << v[i] << " ";
  }
}
void input(long long int a[], long long int sz) {
  for (long long int i = 0; i < sz; i++) cin >> a[i];
}
void prll(long long int a[], long long int sz) {
  for (long long int i = 0; i < sz; i++) {
    if (i == sz - 1)
      cout << a[i] << "\n";
    else
      cout << a[i] << " ";
  }
}
long long int dx1[] = {1, 1, 0, -1, -1, -1, 0, 1};
long long int dy1[] = {0, 1, 1, 1, 0, -1, -1, -1};
long long int dx2[] = {1, 0, -1, 0};
long long int dy2[] = {0, 1, 0, -1};
long long int mul(long long int a, long long int b,
                  long long int p = 1000000007) {
  return ((a % p) * (b % p)) % p;
}
long long int add(long long int a, long long int b,
                  long long int p = 1000000007) {
  return (a % p + b % p) % p;
}
long long int power(long long int x, long long int y,
                    long long int p = 1000000007) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int modInverse(long long int n, long long int p = 1000000007) {
  return power(n, p - 2, p);
}
long long int ncrMod(long long int n, long long int r,
                     long long int p = 1000000007) {
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
bool isPrime(long long int n) {
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
long long int n, m, visited[100][100], cnt;
string s[100];
bool isValid(long long int x, long long int y) {
  if (x < 0 or y < 0 or x >= n or y >= m) {
    return false;
  }
  if (visited[x][y] != 0) {
    return false;
  }
  if (s[x][y] == 'W') {
    return false;
  }
  return true;
}
void dfs(long long int x, long long int y) {
  visited[x][y] = cnt;
  for (int i = 0; i < 4; i++) {
    long long int newx = x + dx2[i];
    long long int newy = y + dy2[i];
    if (isValid(newx, newy)) {
      dfs(newx, newy);
    }
  }
}
void solve() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'B' and visited[i][j] == 0) {
        cnt++;
        dfs(i, j);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'B') {
        if (visited[i][j] == 1) {
          long long int temp = 0;
          for (int k = 0; k < m; k++) {
            if (s[i][k] == 'B') {
              if (temp == 0) {
                temp = 1;
              } else if (temp == 2) {
                cout << "NO"
                     << "\n";
                return;
              }
            } else {
              if (temp == 1) {
                temp = 2;
              }
            }
          }
          temp = 0;
          for (int k = 0; k < n; k++) {
            if (s[k][j] == 'B') {
              if (temp == 0) {
                temp = 1;
              } else if (temp == 2) {
                cout << "NO"
                     << "\n";
                return;
              }
            } else {
              if (temp == 1) {
                temp = 2;
              }
            }
          }
        } else {
          cout << "NO"
               << "\n";
          return;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (visited[i][j] == 1) {
        for (int k = 0; k < n; k++) {
          if (k == i) {
            continue;
          }
          for (int l = 0; l < m; l++) {
            if (visited[k][l] == 1 and
                (visited[i][l] != 1 and visited[k][j] != 1)) {
              cout << "NO"
                   << "\n";
              return;
            }
          }
        }
      }
    }
  }
  cout << "YES"
       << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
