/* --- author: dxm --- */
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

void qread(int &x){
	int neg=1;x=0;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')neg=-1;c=getchar();}
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	x*=neg;
}

const int maxn=200005;
int n,m,q,cntr,cntc;
char rs[maxn],cs[maxn];
int r[maxn],c[maxn],curr[maxn],curc[maxn];
int rnxt[maxn][2],rprv[maxn][2],cnxt[maxn][2],cprv[maxn][2];
int dist[maxn];
priority_queue<pii>pq;
vector<pii>edge[maxn];
//0: from left to right & from up to down
//1: from right to left & from down to up

int getid(int x,int y){
	return x*cntc+y;
}

int calc(int s,int t,int n){
	rep(i,n)dist[i]=INF;
	dist[s]=0;
	pq.push(mp(0,s));
	while(!pq.empty()){
		pii x=pq.top();
		pq.pop();
		x.fst=-x.fst;
		if(dist[x.snd]!=x.fst)continue;
		rep(i,edge[x.snd].size()){
			pii y=edge[x.snd][i];
			if(dist[y.fst]>dist[x.snd]+y.snd){
				dist[y.fst]=dist[x.snd]+y.snd;
				pq.push(mp(-dist[y.fst],y.fst));
			} 
		}
	}
	if(dist[t]==INF)return -1;
	return dist[t];
}

int main(){
#ifdef FILE
	freopen("FILE.in","r",stdin);
	freopen("FILE.out","w",stdout);
#endif
	scanf("%d%d%d%s%s",&n,&m,&q,rs,cs);
	rep(i,n){
		r[i]=rs[i]=='W';
		rep(j,2){
			rprv[i][j]=(!i?-1:rprv[i-1][j]);
			if(j==r[i])rprv[i][j]=i;
		} 
	}
	for(int i=n-1;i>=0;i--){
		rep(j,2){
			rnxt[i][j]=(i==n-1?n:rnxt[i+1][j]);
			if(j==r[i])rnxt[i][j]=i;
		}
	}
	rep(i,m){
		c[i]=cs[i]=='N';
		rep(j,2){
			cprv[i][j]=(!i?-1:cprv[i-1][j]);
			if(j==c[i])cprv[i][j]=i;
		}
	}
	for(int i=m-1;i>=0;i--){
		rep(j,2){
			cnxt[i][j]=(i==m-1?m:cnxt[i+1][j]);
			if(j==c[i])cnxt[i][j]=i;
		}
	}
	while(q--){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		a--;b--;c--;d--;
		cntr=0,cntc=0;
		int ida,idb,idc,idd;
		curr[cntr++]=a;
		if(a&&rprv[a-1][1^r[a]]>=0)curr[cntr++]=rprv[a-1][1^r[a]];
		if(a<n-1&&rnxt[a+1][1^r[a]]<n)curr[cntr++]=rnxt[a+1][1^r[a]];
		curr[cntr++]=c;
		if(c&&rprv[c-1][1^r[c]]>=0)curr[cntr++]=rprv[c-1][1^r[c]];
		if(c<n-1&&rnxt[c+1][1^r[c]]<n)curr[cntr++]=rnxt[c+1][1^r[c]];
		curc[cntc++]=b;
		if(b&&cprv[b-1][1^::c[b]]>=0)curc[cntc++]=cprv[b-1][1^::c[b]];
		if(b<m-1&&cnxt[b+1][1^::c[b]]<m)curc[cntc++]=cnxt[b+1][1^::c[b]];
		curc[cntc++]=d;
		if(d&&cprv[d-1][1^::c[d]]>=0)curc[cntc++]=cprv[d-1][1^::c[d]];
		if(d<m-1&&cnxt[d+1][1^::c[d]]<m)curc[cntc++]=cnxt[d+1][1^::c[d]];
		sort(curr,curr+cntr);
		sort(curc,curc+cntc);
		rep(i,cntr){
			if(i>0&&curr[i]==curr[i-1]){
				for(int j=i+1;j<cntr;j++)curr[j-1]=curr[j];
				cntr--;
			}
		}
		rep(i,cntr){
			if(curr[i]==a)ida=i;
			if(curr[i]==c)idc=i;
		}
		rep(i,cntc){
			if(i>0&&curc[i]==curc[i-1]){
				for(int j=i+1;j<cntc;j++)curc[j-1]=curc[j];
				cntc--;
			}
		}
		rep(i,cntc){
			if(curc[i]==b)idb=i;
			if(curc[i]==d)idd=i;
		}
		rep(i,cntr)rep(j,cntc){
			if(!r[curr[i]]&&j<cntc-1)edge[getid(i,j)].pb(mp(getid(i,j+1),curc[j+1]-curc[j]));
			if(r[curr[i]]&&j>0)edge[getid(i,j)].pb(mp(getid(i,j-1),curc[j]-curc[j-1]));
			if(!::c[curc[j]]&&i<cntr-1)edge[getid(i,j)].pb(mp(getid(i+1,j),curr[i+1]-curr[i]));
			if(::c[curc[j]]&&i>0)edge[getid(i,j)].pb(mp(getid(i-1,j),curr[i]-curr[i-1]));
		}
		printf("%d\n",calc(getid(ida,idb),getid(idc,idd),cntr*cntc));
		rep(i,cntr*cntc)edge[i].clear();
	}
#ifdef TIME
	printf("Running Time = %d ms\n",int(clock()*1000.0/CLOCKS_PER_SEC));
#endif
	return 0;
}

/*
Input:
-----------------
Output:
*/


Measured memory_bytes: 16128