#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#include <set>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;

const int MAXN = (int)1e2 + 1;
const int MAX_IT = (int)1e4 + 1;

const char cx[4] = { 'n', 'e', 's', 'w' };
const int dx[4] = { -1, 0, 1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int n, m, G;
char mm[MAXN][MAXN];
bool used[MAXN][MAXN];

struct Robot
{
	int x, y, cnt;
	int dx, dy;
	Robot(int x, int y) : x(x), y(y), dx(x), dy(y), cnt(0) {};
};

vector < Robot > rr;

void input()
{
	scanf("%d %d %d\n", &n, &m, &G);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
			scanf("%c", &mm[i][j]);
		getchar();
	}
} 

inline bool isUpcase(char x)
{
	return 'A' <= x && x <= 'Z';
}

inline void lower_case(char &x)
{
	if (x == 'N')
		x = 'n';
	if (x == 'E')
		x = 'e';
	if (x == 'S')
		x = 's';
	if (x == 'W')
		x = 'w';
}

/*inline pair < int, int > go(int x, int y)
{
	for (int k = 0; k < 4; k++)
	{
		if (cx[k] == mm[x][y])
			return{ x + dx[k], y + dy[k] };
	}
	assert(false);
}*/

void slow()
{
	//clock_t start = clock();
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if (isUpcase(mm[i][j]))
			{
				rr.push_back(Robot(i, j));
				lower_case(mm[i][j]);
			}
		}
	}
	int sz = (int)rr.size();
	vector < int > gg;
	int nx, ny;
	for (int it = 0; it < MAX_IT; it++)
	{
		gg.clear();
		for (int i = 0; i < sz; i++)
		{
			for (int k = 0; k < 4; k++)
			{
				if (cx[k] == mm[rr[i].x][rr[i].y])
				{
					nx = rr[i].x + dx[k];
					ny = rr[i].y + dy[k];
				}
			}
			if (!used[nx][ny])
			{
				used[nx][ny] = true;
				rr[i].x = nx;
				rr[i].y = ny;
				gg.push_back(i);
			}
			//else
			//	rr[i].cnt++;
		}
		for (int i = 0; i < (int)gg.size(); i++)
			used[rr[gg[i]].x][rr[gg[i]].y] = false;
	}
	int ans = (int)gg.size();
	printf("%d\n", ans);
	if (G)
	{
		sz = (int)gg.size();
		int id;
		vector < Robot > newrr;
		for (int i = 0; i < sz; i++)
		{
			id = gg[i];
			newrr.push_back(Robot(rr[id].dx, rr[id].dy));
		}
		rr = newrr;
		for (int it = 0; it < MAX_IT; it++)
		{
			for (int i = 0; i < sz; i++)
			{
				for (int k = 0; k < 4; k++)
				{
					if (cx[k] == mm[rr[i].x][rr[i].y])
					{
						nx = rr[i].x + dx[k];
						ny = rr[i].y + dy[k];
					}
				}
				if (!used[nx][ny])
				{
					used[nx][ny] = true;
					rr[i].x = nx;
					rr[i].y = ny;
				}
				else
					rr[i].cnt++;
			}
			for (int i = 0; i < sz; i++)
				used[rr[i].x][rr[i].y] = false;
		}
		int x, y, t;
		for (int i = 0; i < ans; i++)
		{
			x = rr[i].dx;
			y = rr[i].dy;
			t = rr[i].cnt;
			printf("%d %d %d\n", x + 1, y + 1, t + 1);
		}
	}
}

int main()
{
	freopen("robots.in", "r", stdin);
	freopen("robots.out", "w", stdout);
	input();
	slow();
	return 0;
}