#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

#define pii pair<int, int>

const int N = 1e3;
int was[N][N];
int time = 0;
int color[N][N];
char c[N][N];
pii q[N];
int sz;

void dfs(int x, int y)
{
	if (color[x][y] != 0) return;
	++color[x][y];
	was[x][y] = time;
	q[sz++] = { x, y };
	int curx, cury;
	curx = x, cury = y;
	if (c[x][y] == 'N')
		curx--;
	if (c[x][y] == 'E')
		cury++;
	if (c[x][y] == 'S')
		curx++;
	if (c[x][y] == 'W')
		cury--;
	if (color[curx][cury] == 0)
	{
		dfs(curx, cury);
		if (color[x][y] == 0) //if we didn't mark it as cycle
			color[x][y] = 1;
		return;
	}
	if (was[curx][cury] == time)
	{
		color[x][y] = 2;
		while (q[sz - 1] != pii(curx, cury))
		{
			--sz;
			color[q[sz].first][q[sz].second] = 2;
		}
		--sz;
		color[q[sz].first][q[sz].second] = 2;
		return;
	}
	if (color[curx][cury] == 2) //two means it's cycle
	{
		color[x][y] = 1;
		return;
	}
	if (color[curx][cury] == 1)
	{
		color[x][y] = 1;
		return;
	}
}

int main()
{
	freopen("robots.in", "r", stdin);
	freopen("robots.out", "w", stdout);
	int n, m, g;
	scanf("%d %d %d", &n, &m, &g);
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
		{
			scanf(" %c", &c[i][j]);
			if (c[i][j] >= 'a' && c[i][j] <= 'z')
				c[i][j] += 'A' - 'a';
		}
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
		{
			if (color[i][j] == 0)
			{
				sz = 0;
				++time;
				dfs(i, j);
			}
		}

	vector <pii> ans;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			if (color[i][j] == 2)
				ans.push_back({ i, j });
	cout << ans.size() << endl;
	for (auto x : ans)
		cout << x.first + 1 << " " << x.second + 1 << " " << 1 << endl;
	
	
	return 0;
}