#include <bits/stdc++.h>
int empty(char (*board)[502], int n, int m, int i, int j, int *di, int *dj) {
  if (board[i + 1][j] == '.') {
    *di = 1;
    *dj = 0;
    return 1;
  } else if (board[i - 1][j] == '.') {
    *di = -1;
    *dj = 0;
    return 1;
  } else if (board[i][j + 1] == '.') {
    *di = 0;
    *dj = 1;
    return 1;
  } else if (board[i][j - 1] == '.') {
    *di = 0;
    *dj = -1;
    return 1;
  }
  return 0;
}
char board[502][502] = {""};
int stack[300000][2] = {{0}};
int op[1000000][3];
int main() {
  int n, m;
  int i, j;
  int it, jt;
  int di, dj;
  int top;
  int total;
  scanf("%d%d", &n, &m);
  getchar();
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      board[i][j] = getchar();
    }
    getchar();
  }
  it = 1;
  jt = 1;
  total = 0;
  while (1) {
    i = it;
    j = jt;
    for (; i <= n; i++) {
      for (; j <= m; j++) {
        if (board[i][j] == '.') break;
      }
      if (j <= m && board[i][j] == '.')
        break;
      else if (i < n)
        j = 1;
    }
    if (i > n && j > m) break;
    it = i;
    jt = j;
    stack[0][0] = i;
    stack[0][1] = j;
    op[total][0] = 1;
    op[total][1] = i;
    op[total][2] = j;
    total++;
    board[i][j] = 'B';
    top = 1;
    while (1) {
      if (empty(board, n, m, i, j, &di, &dj)) {
        i += di;
        j += dj;
        stack[top][0] = i;
        stack[top][1] = j;
        op[total][0] = 1;
        op[total][1] = i;
        op[total][2] = j;
        total++;
        board[i][j] = 'B';
        top++;
      } else {
        if (top > 1) {
          if (board[stack[top - 2][0]][stack[top - 2][1]] == 'B') {
            op[total][0] = 2;
            op[total][1] = i;
            op[total][2] = j;
            total++;
            op[total][0] = 3;
            op[total][1] = i;
            op[total][2] = j;
            total++;
            board[i][j] = 'R';
          }
          top--;
          i = stack[top - 1][0];
          j = stack[top - 1][1];
        } else
          break;
      }
    }
  }
  printf("%d\n", total);
  for (i = 0; i < total; i++) {
    switch (op[i][0]) {
      case 1:
        printf("B ");
        break;
      case 2:
        printf("D ");
        break;
      case 3:
        printf("R ");
        break;
    }
    printf("%d %d\n", op[i][1], op[i][2]);
  }
  return 0;
}
