#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <string>
#define mp make_pair
using namespace std;


typedef long long ll;

const int MAXN = 1001;

int a[MAXN][MAXN];
string s[MAXN];
vector <pair <int, int> > ans;
int w[MAXN][MAXN];
int x[MAXN][MAXN], y[MAXN][MAXN];
int main()
{
	ios_base::sync_with_stdio(0);
	freopen("robots.in", "r", stdin);
	freopen("robots.out", "w", stdout);
	int n, m, g;
	cin >> n >> m >> g;
	memset(w, 0, sizeof(w));
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
		for (int j = 0; j < m; j++)
		{
			x[i][j] = i, y[i][j] = j;
			char c = tolower(s[i][j]);
			if (c == 'n') x[i][j]--;
			if (c == 's') x[i][j]++;
			if (c == 'w') y[i][j]--;
			if (c == 'e') y[i][j]++;
		}
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if (w[i][j]) continue;
			int ci = i, cj = j;
			while (!w[ci][cj])
			{
				int ni = x[ci][cj], nj = y[ci][cj];
				w[ci][cj] = 1;
				ci = ni, cj = nj;
			}
			if (w[ci][cj] == 1)
			{
				int ai = ci, aj = cj;
				do
				{
					int ni = x[ci][cj], nj = y[ci][cj];
					ans.push_back(mp(ni, nj));
					ci = ni, cj = nj;
				} while ((ci != ai) || (cj != aj));
			}
			ci = i, cj = j;
			while (w[ci][cj] != 2)
			{
				int ni = x[ci][cj], nj = y[ci][cj];
				w[ci][cj] = 2;
				ci = ni, cj = nj;
			}
		}
	}
	cout << ans.size() << "\n";
	if (g)
	{
		for (int i = 0; i < ans.size(); i++) cout << ans[i].first + 1 << " " << ans[i].second + 1 << " 0\n";
	}
	return 0;
}