#include <bits/stdc++.h>
using std::queue;
char map[55][55];
int n, m;
int check() {
  int i, j, k, l, p;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      for (k = 0; k < n; k++)
        for (l = 0; l < m; l++) {
          if (i == k && j == l) continue;
          if (map[i][j] != 'B' || map[k][l] != 'B') continue;
          int ok1 = 1, ok2 = 1;
          if (k > i) {
            if (l > j) {
              for (p = i; p <= k; p++)
                if (map[p][j] == 'W') ok1 = 0;
              for (p = j; p <= l; p++)
                if (map[k][p] == 'W') ok1 = 0;
              for (p = j; p <= l; p++)
                if (map[i][p] == 'W') ok2 = 0;
              for (p = i; p <= k; p++)
                if (map[p][l] == 'W') ok2 = 0;
              if (!ok1 && !ok2) return 0;
            } else {
              for (p = i; p <= k; p++)
                if (map[p][j] == 'W') ok1 = 0;
              for (p = j; p >= l; p--)
                if (map[k][p] == 'W') ok1 = 0;
              for (p = j; p >= l; p--)
                if (map[i][p] == 'W') ok2 = 0;
              for (p = i; p <= k; p++)
                if (map[p][l] == 'W') ok2 = 0;
              if (!ok1 && !ok2) return 0;
            }
          } else {
            if (l > j) {
              for (p = i; p >= k; p--)
                if (map[p][j] == 'W') ok1 = 0;
              for (p = j; p <= l; p++)
                if (map[k][p] == 'W') ok1 = 0;
              for (p = j; p <= l; p++)
                if (map[i][p] == 'W') ok2 = 0;
              for (p = i; p >= k; p--)
                if (map[p][l] == 'W') ok2 = 0;
              if (!ok1 && !ok2) return 0;
            } else {
              for (p = i; p >= k; p--)
                if (map[p][j] == 'W') ok1 = 0;
              for (p = j; p >= l; p--)
                if (map[k][p] == 'W') ok1 = 0;
              for (p = j; p >= l; p--)
                if (map[i][p] == 'W') ok2 = 0;
              for (p = i; p >= k; p--)
                if (map[p][l] == 'W') ok2 = 0;
              if (!ok1 && !ok2) return 0;
            }
          }
        }
  return 1;
}
int main(void) {
  scanf("%d%d", &n, &m);
  int i, j;
  char s[55];
  for (i = 0; i < n; i++) {
    scanf("%s", s);
    for (j = 0; j < m; j++) map[i][j] = s[j];
  }
  if (!check())
    printf("NO\n");
  else
    printf("YES\n");
}
