#include <bits/stdc++.h>
using namespace std;
int n, m;
char mat[505][505];
int vis[505][505];
int dir[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int k;
bool dfs(int x, int y, bool kind) {
  if (vis[x][y]) return false;
  vis[x][y] = 1;
  if (kind)
    printf("B %d %d\n", x + 1, y + 1);
  else
    k++;
  int nx, ny;
  for (int i = 0; i < 4; ++i) {
    nx = x + dir[i][0];
    ny = y + dir[i][1];
    if (nx >= 0 && nx < n && ny >= 0 && ny < m && mat[nx][ny] == '.') {
      if (dfs(nx, ny, kind)) {
        if (kind) {
          printf("D %d %d\n", nx + 1, ny + 1);
          printf("R %d %d\n", nx + 1, ny + 1);
        } else
          k += 2;
      }
    }
  }
  return true;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%s", mat[i]);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (!vis[i][j] && mat[i][j] == '.') dfs(i, j, 0);
  printf("%d\n", k);
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (!vis[i][j] && mat[i][j] == '.') dfs(i, j, 1);
  return 0;
}
