#include <bits/stdc++.h>
using namespace std;
const int Maxn = 501;
typedef pair<int, int> pie;
vector<pie> edges[Maxn][Maxn];
int chap[3][(Maxn * 3 * Maxn) + 10];
bool mark[Maxn][Maxn];
bool mark1[Maxn][Maxn];
char arr[Maxn][Maxn];
int n, m;
void input() {
  cin >> n >> m;
  char c;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> arr[i][j];
    }
  }
}
void CreateGraph() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (arr[i][j] == '.') {
        if (arr[i - 1][j] == '.') {
          edges[i][j].push_back(pie(i - 1, j));
        }
        if (arr[i][j + 1] == '.') {
          edges[i][j].push_back(pie(i, j + 1));
        }
        if (arr[i][j - 1] == '.') {
          edges[i][j].push_back(pie(i, j - 1));
        }
        if (arr[i + 1][j] == '.') {
          edges[i][j].push_back(pie(i + 1, j));
        }
      }
    }
  }
}
int Point = 1;
int root1, root2;
void DFS1(int a, int b) {
  mark1[a][b] = true;
  for (int i = 0; i < edges[a][b].size(); i++) {
    if (mark1[edges[a][b][i].first][edges[a][b][i].second] == false) {
      DFS1(edges[a][b][i].first, edges[a][b][i].second);
    }
  }
  chap[0][Point] = 2;
  chap[1][Point] = a;
  chap[2][Point] = b;
  Point++;
}
void DFS(int a, int b) {
  mark[a][b] = true;
  for (int i = 0; i < edges[a][b].size(); i++) {
    if (mark[edges[a][b][i].first][edges[a][b][i].second] == false) {
      DFS(edges[a][b][i].first, edges[a][b][i].second);
    }
  }
  if (a != root1 || b != root2) {
    chap[0][Point] = 3;
    chap[1][Point] = a;
    chap[2][Point] = b;
    Point++;
    chap[0][Point] = 1;
    chap[1][Point] = a;
    chap[2][Point] = b;
    Point++;
  }
}
int main() {
  input();
  CreateGraph();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (mark[i][j] == false && arr[i][j] != '#') {
        root1 = i;
        root2 = j;
        DFS1(i, j);
        DFS(i, j);
      }
    }
  }
  cout << Point - 1 << endl;
  for (int i = 1; i < Point; i++) {
    if (chap[0][i] == 1)
      cout << "R"
           << " ";
    else if (chap[0][i] == 2)
      cout << "B"
           << " ";
    else
      cout << "D"
           << " ";
    cout << chap[1][i] << " " << chap[2][i] << endl;
  }
}
