#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl

int n,m,q;
char s[125252];
int rw[125252], re[125252], lw[125252], le[125252];
char t[125252];
int rn[125252], rs[125252], ln[125252], ls[125252];

int main(){
	scanf("%d%d%d",&n,&m,&q);
	scanf("%s",s);
	scanf("%s",t);

	rw[n-1] = s[n-1]=='W' ? n-1 : -1;
	re[n-1] = s[n-1]=='E' ? n-1 : -1;
	FORR(i,0,n-1){
		rw[i] = s[i]=='W' ? i : rw[i+1];
		re[i] = s[i]=='E' ? i : re[i+1];
	}
	lw[0] = s[0]=='W' ? 0 : -1;
	le[0] = s[0]=='E' ? 0 : -1;
	FOR(i,1,n){
		lw[i] = s[i]=='W' ? i : lw[i-1];
		le[i] = s[i]=='E' ? i : le[i-1];
	}

	rn[m-1] = t[m-1]=='N' ? m-1 : -1;
	rs[m-1] = t[m-1]=='S' ? m-1 : -1;
	FORR(i,0,m-1){
		rn[i] = t[i]=='N' ? i : rn[i+1];
		rs[i] = t[i]=='S' ? i : rs[i+1];
	}
	ln[0] = t[0]=='N' ? 0 : -1;
	ls[0] = t[0]=='S' ? 0 : -1;
	FOR(i,1,m){
		ln[i] = t[i]=='N' ? i : ln[i-1];
		ls[i] = t[i]=='S' ? i : ls[i-1];
	}

	while(q--){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		--a;--b;--c;--d;
		set<pii> ys,xs;
		ys.insert(pii(a,s[a]));
		ys.insert(pii(c,s[c]));
		if(s[a]=='W'){
			int y;
			y=le[a];if(y!=-1)ys.insert(pii(y,s[y]));
			y=re[a];if(y!=-1)ys.insert(pii(y,s[y]));
		}else{
			int y;
			y=lw[a];if(y!=-1)ys.insert(pii(y,s[y]));
			y=rw[a];if(y!=-1)ys.insert(pii(y,s[y]));
		}
		if(s[c]=='W'){
			int y;
			y=le[c];if(y!=-1)ys.insert(pii(y,s[y]));
			y=re[c];if(y!=-1)ys.insert(pii(y,s[y]));
		}else{
			int y;
			y=lw[c];if(y!=-1)ys.insert(pii(y,s[y]));
			y=rw[c];if(y!=-1)ys.insert(pii(y,s[y]));
		}
		xs.insert(pii(b,t[b]));
		xs.insert(pii(d,t[d]));
		if(t[b]=='N'){
			int x;
			x=ls[b];if(x!=-1)xs.insert(pii(x,t[x]));
			x=rs[b];if(x!=-1)xs.insert(pii(x,t[x]));
		}else{
			int x;
			x=ln[b];if(x!=-1)xs.insert(pii(x,t[x]));
			x=rn[b];if(x!=-1)xs.insert(pii(x,t[x]));
		}
		if(t[d]=='N'){
			int x;
			x=ls[d];if(x!=-1)xs.insert(pii(x,t[x]));
			x=rs[d];if(x!=-1)xs.insert(pii(x,t[x]));
		}else{
			int x;
			x=ln[d];if(x!=-1)xs.insert(pii(x,t[x]));
			x=rn[d];if(x!=-1)xs.insert(pii(x,t[x]));
		}
		vector<pii> xx, yy;
		for(pii P : xs){
			xx.push_back(P);
		}
		for(pii P : ys){
			yy.push_back(P);
		}
		int sx,sy,gx,gy;
		int X = xx.size();
		int Y = yy.size();
		REP(i,Y)REP(j,X){
			if(yy[i].first==a && xx[j].first==b){
				sy=i; sx=j;
			}
			if(yy[i].first==c && xx[j].first==d){
				gy=i; gx=j;
			}
		}
		vi dist(X*Y, 1<<30);
		priority_queue<pii> Q;
		dist[sy*X+sx] = 0;
		Q.push(pii(0,sy*X+sx));
		while(!Q.empty()){
			pii P = Q.top(); Q.pop();
			if(-P.first != dist[P.second])continue;
			int y = P.second / X;
			int x = P.second % X;
			int d = dist[P.second];
			if(yy[y].second=='E' && x+1<X){
				int np = (y+0)*X+(x+1);
				int nd = d + abs(xx[x+1].first-xx[x].first);
				if(nd < dist[np]){
					dist[np] = nd;
					Q.push(pii(-nd,np));
				}
			}else if(yy[y].second == 'W' && x-1>=0){
				int np = (y+0)*X+(x-1);
				int nd = d + abs(xx[x-1].first-xx[x].first);
				if(nd < dist[np]){
					dist[np] = nd;
					Q.push(pii(-nd,np));
				}
			}
			if(xx[x].second=='S' && y+1<Y){
				int np = (y+1)*X+(x+0);
				int nd = d + abs(yy[y+1].first-yy[y].first);
				if(nd < dist[np]){
					dist[np] = nd;
					Q.push(pii(-nd,np));
				}
			}else if(xx[x].second=='N' && y-1>=0){
				int np = (y-1)*X+(x+0);
				int nd = d + abs(yy[y-1].first-yy[y].first);
				if(nd < dist[np]){
					dist[np] = nd;
					Q.push(pii(-nd,np));
				}
			}
		}
		// puts("");
		// REP(i,X)printf("(%d,%c) ",xx[i].first,(char)xx[i].second);puts("");
		// REP(i,Y)printf("(%d,%c) ",yy[i].first,(char)yy[i].second);puts("");
		// DEBUG(sx);DEBUG(sy);DEBUG(gx);DEBUG(gy);
		int ans = dist[gy*X+gx];
		if(ans==(1<<30)){
			puts("-1");
		}else{
			printf("%d\n",ans);
		}
		// break;
	}
	return 0;
}


Measured memory_bytes: 5248