#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N, M, Q; string S, T;
vector<int>X1, X2, Y1, Y2;
vector<int>needX[100009], needY[100009];

void get_x() {
	for (int i = 0; i < N; i++) {
		if (S[i] == 'E') {
			needX[i].push_back(i);
			int pos1 = lower_bound(X2.begin(), X2.end(), i) - X2.begin(); pos1--;
			int pos2 = pos1 + 1;

			if (pos1 >= 0 && pos1 < X2.size()) {
				needX[i].push_back(X2[pos1]);
				int pos3 = lower_bound(X1.begin(), X1.end(), X2[pos1]) - X1.begin(); pos3--;
				if (pos3 >= 0) needX[i].push_back(X1[pos3]);
			}
			if (pos2 >= 0 && pos2 < X2.size()) {
				needX[i].push_back(X2[pos2]);
				int pos3 = lower_bound(X1.begin(), X1.end(), X2[pos2]) - X1.begin();
				if (pos3 < X1.size()) needX[i].push_back(X1[pos3]);
			}
		}
		if (S[i] == 'W') {
			needX[i].push_back(i);
			int pos1 = lower_bound(X1.begin(), X1.end(), i) - X1.begin(); pos1--;
			int pos2 = pos1 + 1;

			if (pos1 >= 0 && pos1 < X1.size()) {
				needX[i].push_back(X1[pos1]);
				int pos3 = lower_bound(X2.begin(), X2.end(), X1[pos1]) - X2.begin(); pos3--;
				if (pos3 >= 0) needX[i].push_back(X2[pos3]);
			}
			if (pos2 >= 0 && pos2 < X1.size()) {
				needX[i].push_back(X1[pos2]);
				int pos3 = lower_bound(X2.begin(), X2.end(), X1[pos2]) - X2.begin();
				if (pos3 < X2.size()) needX[i].push_back(X2[pos3]);
			}
		}
	}
}

void get_y() {
	for (int i = 0; i < M; i++) {
		if (T[i] == 'N') {
			needY[i].push_back(i);
			int pos1 = lower_bound(Y2.begin(), Y2.end(), i) - Y2.begin(); pos1--;
			int pos2 = pos1 + 1;

			if (pos1 >= 0 && pos1 < Y2.size()) {
				needY[i].push_back(Y2[pos1]);
				int pos3 = lower_bound(Y1.begin(), Y1.end(), Y2[pos1]) - Y1.begin(); pos3--;
				if (pos3 >= 0) needY[i].push_back(Y1[pos3]);
			}
			if (pos2 >= 0 && pos2 < Y2.size()) {
				needY[i].push_back(Y2[pos2]);
				int pos3 = lower_bound(Y1.begin(), Y1.end(), Y2[pos2]) - Y1.begin();
				if (pos3 < Y1.size()) needY[i].push_back(Y1[pos3]);
			}
		}
		if (T[i] == 'S') {
			needY[i].push_back(i);
			int pos1 = lower_bound(Y1.begin(), Y1.end(), i) - Y1.begin(); pos1--;
			int pos2 = pos1 + 1;

			if (pos1 >= 0 && pos1 < Y1.size()) {
				needY[i].push_back(Y1[pos1]);
				int pos3 = lower_bound(Y2.begin(), Y2.end(), Y1[pos1]) - Y2.begin(); pos3--;
				if (pos3 >= 0) needY[i].push_back(Y2[pos3]);
			}
			if (pos2 >= 0 && pos2 < Y1.size()) {
				needY[i].push_back(Y1[pos2]);
				int pos3 = lower_bound(Y2.begin(), Y2.end(), Y1[pos2]) - Y2.begin();
				if (pos3 < Y2.size()) needY[i].push_back(Y2[pos3]);
			}
		}
	}
}

char u[10], v[10]; int dist[10][10];

int solve(int ax, int ay, int bx, int by) {
	vector<int>X, Y;
	for (int i : needX[ax]) X.push_back(i);
	for (int i : needX[bx]) X.push_back(i);
	for (int i : needY[ay]) Y.push_back(i);
	for (int i : needY[by]) Y.push_back(i);
	sort(X.begin(), X.end()); X.erase(unique(X.begin(), X.end()), X.end());
	sort(Y.begin(), Y.end()); Y.erase(unique(Y.begin(), Y.end()), Y.end());

	for (int i = 0; i < X.size(); i++) u[i] = S[X[i]];
	for (int i = 0; i < Y.size(); i++) v[i] = T[Y[i]];

	for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) dist[i][j] = (1 << 30); }

	int sx = lower_bound(X.begin(), X.end(), ax) - X.begin();
	int sy = lower_bound(Y.begin(), Y.end(), ay) - Y.begin();
	int gx = lower_bound(X.begin(), X.end(), bx) - X.begin();
	int gy = lower_bound(Y.begin(), Y.end(), by) - Y.begin();

	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>que;
	dist[sx][sy] = 0; que.push(make_pair(0, sx * 16 + sy));

	while (!que.empty()) {
		int G = que.top().second; que.pop();
		int lx = (G >> 4), ly = (G & 15);

		// EW 方面
		if (u[lx] == 'E') {
			if (ly + 1 < Y.size() && dist[lx][ly + 1] > dist[lx][ly] + (Y[ly + 1] - Y[ly])) {
				dist[lx][ly + 1] = dist[lx][ly] + (Y[ly + 1] - Y[ly]);
				que.push(make_pair(dist[lx][ly + 1], G + 1));
			}
		}
		if (u[lx] == 'W') {
			if (ly > 0 && dist[lx][ly - 1] > dist[lx][ly] + (Y[ly] - Y[ly - 1])) {
				dist[lx][ly - 1] = dist[lx][ly] + (Y[ly] - Y[ly - 1]);
				que.push(make_pair(dist[lx][ly - 1], G - 1));
			}
		}

		// NS 方面
		if (v[ly] == 'N') {
			if (lx > 0 && dist[lx - 1][ly] > dist[lx][ly] + (X[lx] - X[lx - 1])) {
				dist[lx - 1][ly] = dist[lx][ly] + (X[lx] - X[lx - 1]);
				que.push(make_pair(dist[lx - 1][ly], G - 16));
			}
		}
		if (v[ly] == 'S') {
			if (lx + 1 < X.size() && dist[lx + 1][ly] > dist[lx][ly] + (X[lx + 1] - X[lx])) {
				dist[lx + 1][ly] = dist[lx][ly] + (X[lx + 1] - X[lx]);
				que.push(make_pair(dist[lx + 1][ly], G + 16));
			}
		}
	}
	if (dist[gx][gy] == (1 << 30)) return -1;
	return dist[gx][gy];
}

int main() {
	cin >> N >> M >> Q;
	cin >> S >> T;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'E') X1.push_back(i);
		if (S[i] == 'W') X2.push_back(i);
	}
	for (int i = 0; i < T.size(); i++) {
		if (T[i] == 'N') Y1.push_back(i);
		if (T[i] == 'S') Y2.push_back(i);
	}
	
	get_x();
	get_y();

	for (int i = 1; i <= Q; i++) {
		int ax, ay, bx, by;
		scanf("%d%d%d%d", &ax, &ay, &bx, &by);
		ax--; ay--; bx--; by--;
		printf("%d\n", solve(ax, ay, bx, by));
	}
	return 0;
}

Measured memory_bytes: 17564