#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef complex<ld> Point;
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

string u[2];
int sx, sy, gx, gy;
vector<int> vx[2][2];
int d[36];
struct edge {
	int to, cost;
};
vector<edge> G[36];
priority_queue<P, vector<P>, greater<P>> que;
void calc(vector<int> x, vector<int> y) {
	rep(i, 36)G[i].clear();
	fill(d, d + 36, mod);
	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());
	int lx = x.size(), ly = y.size();
	int s=0, g=0;
	rep(i, x.size()) {
		if (sx == x[i]) {
			s += i * ly;
		}
		if (gx == x[i]) {
			g += i * ly;
		}
	}
	rep(i, y.size()) {
		if (sy == y[i]) {
			s += i;
		}
		if (gy == y[i]) {
			g += i;
		}
	}
	rep(i, lx - 1) {
		int dif = x[i + 1] - x[i];
		rep(j, ly) {
			int id = i * ly + j;
			if (u[1][y[j]] == 'N') {
				G[id + ly].push_back({ id,dif });
			}
			else {
				G[id].push_back({ id + ly,dif });
			}
		}
	}
	rep(i, lx) {
		rep(j, ly - 1) {
			int dif = y[j + 1] - y[j];
			int id = i * ly + j;
			if (u[0][x[i]] == 'W') {
				G[id + 1].push_back({ id,dif });
			}
			else {
				G[id].push_back({ id + 1,dif });
			}
		}
	}
	d[s] = 0; que.push({ 0,s });
	while (!que.empty()) {
		P p = que.top(); que.pop();
		int v = p.second;
		rep(j, G[v].size()) {
			int to = G[v][j].to;
			int nd = G[v][j].cost + p.first;
			if(nd < d[to]) {
				d[to] = nd;
				que.push({ nd,to });
			}
		}
	}
	int ret = d[g];
	if (ret == mod)ret = -1;
	cout << ret << endl;
}
int trans(char t) {
	if (t == 'W' || t == 'N')return 0;
	else return 1;
}
vector<int> x[2];
void add(int id,int loc) {
	x[id].push_back(loc);
	int t = trans(u[id][loc]);
	int idd= upper_bound(vx[id][t ^ 1].begin(), vx[id][t ^ 1].end(), loc) - vx[id][t ^ 1].begin();
	if (idd < vx[id][t ^ 1].size()) {
		x[id].push_back(vx[id][t ^ 1][idd]);
	}
	if (idd >= 1) {
		x[id].push_back(vx[id][t ^ 1][idd - 1]);
	}
}
void solve() {
	int n[2], q; cin >> n[0] >> n[1] >> q;
	rep(i, 2) {
		cin >> u[i];
		rep(j, n[i]) {
			if (u[i][j] == 'W') {
				vx[0][0].push_back(j);
			}
			else if (u[i][j] == 'E') {
				vx[0][1].push_back(j);
			}
			else if (u[i][j] == 'N') {
				vx[1][0].push_back(j);
			}
			else {
				vx[1][1].push_back(j);
			}
		}
	}
	rep(i, q) {
		x[0].clear(); x[1].clear();
		cin >> sx >> sy >> gx >> gy;
		sx--; sy--; gx--; gy--;
		add(0, sx); add(1, sy);
		add(0, gx); add(1, gy);
		calc(x[0],x[1]);
		/*rep(j, x[0].size()) {
			cout << x[0][j] << endl;
		}
		cout << "in" << endl;
		rep(j, x[1].size()) {
			cout << x[1][j] << endl;
		}
		cout << "out" << endl;*/
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 2800