import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.concurrent.ArrayBlockingQueue;

public class chess_vd {
	BufferedReader in;
	StringTokenizer str;
	PrintWriter out;
	String SK;

	String next() throws IOException {
		while ((str == null) || (!str.hasMoreTokens())) {
			SK = in.readLine();
			if (SK == null)
				return null;
			str = new StringTokenizer(SK);
		}
		return str.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	class Edge {
		int to;
		Edge rev;
		int flow;
		int x;
		int y;

		public Edge(int to, int flow, int x, int y) {
			this.to = to;
			this.x = x;
			this.y = y;
			this.flow = flow;
		}
	}

	ArrayList<Edge>[] c;
	int[] here;

	boolean dfs(int v) {
		if (v == 4 * (n + m)) {
			return true;
		}
		here[v] = 1;
		for (Edge e : c[v]) {
			if (e.flow == 1 && here[e.to] == 0) {
				if (dfs(e.to)) {
					e.flow = 0;
					e.rev.flow = 1;
					return true;
				}
			}
		}
		return false;
	}

	int n;
	int m;

	int[][] solve(int[][] b) {
		c = new ArrayList[4 * (n + m) + 1];
		for (int i = 0; i <= 4 * (n + m); i++) {
			c[i] = new ArrayList<Edge>();
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (b[i][j] == 1) {
					int from = i - j + n + m;
					int to = i + j + 2 * (n + m);
					Edge e1 = new Edge(to, 1, i, j);
					Edge e2 = new Edge(from, 0, i, j);
					e1.rev = e2;
					e2.rev = e1;
					c[from].add(e1);
					c[to].add(e2);
				}
			}
		}
		for (int i = 1; i < 2 * (n + m); i++) {
			int from = 0;
			int to = i;
			Edge e1 = new Edge(to, 1, i, i);
			Edge e2 = new Edge(from, 0, i, i);
			e1.rev = e2;
			e2.rev = e1;
			c[from].add(e1);
			c[to].add(e2);
		}
		for (int i = 2 * (n + m); i < 4 * (n + m); i++) {
			int from = i;
			int to = 4 * (n + m);
			Edge e1 = new Edge(to, 1, i, i);
			Edge e2 = new Edge(from, 0, i, i);
			e1.rev = e2;
			e2.rev = e1;
			c[from].add(e1);
			c[to].add(e2);

		}
		here = new int[4 * (n + m) + 1];
		int size = 0;
		while (dfs(0)) {
			size++;
			Arrays.fill(here, 0);
		}
		int[][] res = new int[size][3];
		int t = 0;
		for (int i = 0; i < 2 * (n + m); i++) {
			if (here[i] == 0) {
				for (Edge e : c[i]) {
					if (e.to == 0) {
						continue;
					}
					res[t][0] = 2;
					res[t][1] = e.x;
					res[t++][2] = e.y;
					break;
				}
			}
		}
		for (int i = 2 * (n + m); i < 4 * (n + m); i++) {
			if (here[i] == 1) {
				for (Edge e : c[i]) {
					if (e.to == 4 * (n + m)) {
						continue;
					}
					res[t][0] = 1;
					res[t][1] = e.x;
					res[t++][2] = e.y;
					break;
				}
			}
		}
		return res;
	}

	void solve() throws IOException {
		n = nextInt();
		m = nextInt();
		int[][] a = new int[n][m];
		for (int i = 0; i < n; i++) {
			String s = next();
			for (int j = 0; j < m; j++) {
				a[i][j] = Math.abs((i + j) % 2 - (s.charAt(j) == 'B' ? 1 : 0));
			}
		}
		int type = 0;
		int[][] res1 = solve(a);
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				a[i][j] = 1 - a[i][j];
			}
		}
		int[][] res2 = solve(a);
		if (res1.length > res2.length) {
			res1 = res2;
			type = 1;
		}
		out.println(res1.length);
		for (int i = 0; i < res1.length; i++) {
			out.print(res1[i][0] + " " + (res1[i][1] + 1) + " "
					+ (res1[i][2] + 1) + " ");
			if ((res1[i][1] + res1[i][2]) % 2 == type) {
				out.println("W");
			} else {
				out.println("B");
			}
		}
	}

	void run() throws IOException {
		in = new BufferedReader(new FileReader("chess.in"));
		out = new PrintWriter("chess.out");
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new chess_vd().run();
	}

}