#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int H,W,Q;
string LR,UD;
int SY,SX,TY,TX;

int LU[202020],LD[202020];
int RU[202020],RD[202020];
int UL[202020],UR[202020];
int DL[202020],DR[202020];

int revx[202020],revy[202020];
ll dist[10][10];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W>>Q;
	cin>>LR>>UD;
	
	
	int U=W-1,D=W-1;
	for(i=W-1;i>=0;i--) {
		if(UD[i]=='N') U=i;
		if(UD[i]=='S') D=i;
		RU[i]=U;
		RD[i]=D;
	}
	U=D=0;
	FOR(i,W) {
		if(UD[i]=='N') U=i;
		if(UD[i]=='S') D=i;
		LU[i]=U;
		LD[i]=D;
	}
	int L=0,R=0;
	FOR(i,H) {
		if(LR[i]=='W') L=i;
		if(LR[i]=='E') R=i;
		UL[i]=L;
		UR[i]=R;
	}
	L=R=H-1;
	for(i=H-1;i>=0;i--) {
		if(LR[i]=='W') L=i;
		if(LR[i]=='E') R=i;
		DL[i]=L;
		DR[i]=R;
	}
	
	while(Q--) {
		cin>>SY>>SX>>TY>>TX;
		SY--;
		SX--;
		TY--;
		TX--;
		vector<int> Xs,Ys;
		Ys.push_back(SY);
		Ys.push_back(TY);
		Ys.push_back(UL[SY]);
		Ys.push_back(UR[SY]);
		Ys.push_back(DL[SY]);
		Ys.push_back(DR[SY]);
		Ys.push_back(UL[TY]);
		Ys.push_back(UR[TY]);
		Ys.push_back(DL[TY]);
		Ys.push_back(DR[TY]);
		Xs.push_back(SX);
		Xs.push_back(TX);
		Xs.push_back(RU[SX]);
		Xs.push_back(RD[SX]);
		Xs.push_back(LU[SX]);
		Xs.push_back(LD[SX]);
		Xs.push_back(RU[TX]);
		Xs.push_back(RD[TX]);
		Xs.push_back(LU[TX]);
		Xs.push_back(LD[TX]);
		sort(ALL(Xs));
		sort(ALL(Ys));
		Xs.erase(unique(ALL(Xs)),Xs.end());
		Ys.erase(unique(ALL(Ys)),Ys.end());
		FOR(i,Xs.size()) revx[Xs[i]]=i;
		FOR(i,Ys.size()) revy[Ys[i]]=i;
		FOR(y,Ys.size()) FOR(x,Xs.size()) dist[y][x]=1LL<<60;
		dist[revy[SY]][revx[SX]]=0;
		priority_queue<pair<ll,int>> PQ;
		PQ.push({0,revy[SY]*10+revx[SX]});
		
		/*
		cout<<"Y  ";
		FORR(y,Ys) cout<<(y+1)<<" ";
		cout<<endl;
		cout<<"X  ";
		FORR(x,Xs) cout<<(x+1)<<" ";
		cout<<endl;
		*/
		while(PQ.size()) {
			ll co=-PQ.top().first;
			int cy=PQ.top().second/10;
			int cx=PQ.top().second%10;
			PQ.pop();
			if(dist[cy][cx]!=co) continue;
			//cout<<"!"<<cx<<" "<<cy<<" "<<co<<endl;
			
			if(LR[Ys[cy]]=='W' && cx) {
				ll nc=co+abs(Xs[cx]-Xs[cx-1]);
				if(nc<dist[cy][cx-1]) {
					dist[cy][cx-1]=nc;
					PQ.push({-nc,(cy)*10+cx-1});
				}
			}
			if(LR[Ys[cy]]=='E' && cx<Xs.size()-1) {
				ll nc=co+abs(Xs[cx]-Xs[cx+1]);
				if(nc<dist[cy][cx+1]) {
					dist[cy][cx+1]=nc;
					PQ.push({-nc,(cy)*10+cx+1});
				}
			}
			if(UD[Xs[cx]]=='N' && cy) {
				ll nc=co+abs(Ys[cy]-Ys[cy-1]);
				if(nc<dist[cy-1][cx]) {
					dist[cy-1][cx]=nc;
					PQ.push({-nc,(cy-1)*10+cx});
				}
			}
			if(UD[Xs[cx]]=='S' && cy<Ys.size()-1) {
				ll nc=co+abs(Ys[cy]-Ys[cy+1]);
				if(nc<dist[cy+1][cx]) {
					dist[cy+1][cx]=nc;
					PQ.push({-nc,(cy+1)*10+cx});
				}
			}
		}
		if(dist[revy[TY]][revx[TX]]==1LL<<60) {
			dist[revy[TY]][revx[TX]]=-1;
		}
		cout<<dist[revy[TY]][revx[TX]]<<endl;
		
	}
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 8016