//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
//~ #pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define erase_duplicates(x) sort(all(x)); (x).resize(distance((x).begin(), unique(all(x))));


using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<
T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<" = "<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<" = "<<h<<", "; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#define cerr if(0)cout
#endif

const int maxn = (1e6)+7;
const int maxk = 20;
const int inf = (1e9)+7;
const LL LLinf = ((LL)1e18)+7LL;
const LD eps = 1e-9;
const LL mod = 1e9+7;

// ***************************** CODE ***************************** //

set<int> gora, dol, lewo, prawo;
const int stala = 2;

int odl(PII a, PII b)
{
  int xd = abs(a.fi - b.fi) + abs(a.se - b.se);
  if(a.fi >= b.fi)
  {
    if(gora.count(a.se))
    {
    //  cerr<<"HEJ"<<endl;
      if(a.se <= b.se)
      {
        if(prawo.count(b.fi))
          return xd;
      }
      if(a.se >= b.se)
      {
        if(lewo.count(b.fi))
          return xd;
      }
    }
  }
  if(a.fi <= b.fi)
  {
    if(dol.count(a.se))
    {
      // cerr<<"HEJ2"<<endl;
      if(a.se <= b.se)
      {
        if(prawo.count(b.fi))
          return xd;
      }
      if(a.se >= b.se)
      {
        if(lewo.count(b.fi))
          return xd;
      }
    }
  }
  if(a.se <= b.se)
  {
    if(prawo.count(a.fi))
    {
      if(a.fi >= b.fi)
      {
        if(gora.count(b.se))
          return xd;
      }
      if(a.fi <= b.fi)
        if(dol.count(b.se))
          return xd;
    }
  }
  if(a.se >= b.se)
  {
    if(lewo.count(a.fi))
    {
      // cerr<<"HEJ"<<endl;
      if(a.fi >= b.fi)
      {
        if(gora.count(b.se))
          return xd;
      }
      if(a.fi <= b.fi)
        if(dol.count(b.se))
          return xd;
    }
  }
  return inf;
}

void dorzuc(vector<pair<int, PII> > & a, vector<pair<int, PII> > b, int dlu)
{
  for(auto s : b)
    a.pb({s.fi + dlu, s.se});
}

vector<pair<int, PII> > gen(PII cur, int k = stala)
{
//  cerr<<cur.fi<<" "<<cur.se<<endl;
  vector<pair<int, PII> > res;
  res.pb({0, cur});
  if(k == 0)
    return res;
    if(gora.count(cur.se))
    {
      if(lewo.count(cur.fi))
      {
        auto it = prawo.lower_bound(cur.fi);
        if(SZ(prawo) > 0 && it != prawo.begin())
        {
          it--;
          auto cnt = gen({*it, cur.se}, k - 1);
          dorzuc(res, cnt, abs(*it - cur.fi));
        }
      }
      else
      {
        auto it = lewo.lower_bound(cur.fi);
        if(SZ(lewo) > 0 && it != lewo.begin())
        {
          it--;
          auto cnt = gen({*it, cur.se}, k - 1);
          dorzuc(res, cnt, abs(*it - cur.fi));
        }
      }
    }
    else
    {
      if(lewo.count(cur.fi))
      {
        auto it = prawo.lower_bound(cur.fi);
        if(SZ(prawo) > 0 && it != prawo.end())
        {
          auto cnt = gen({*it, cur.se}, k - 1);
          dorzuc(res, cnt, abs(*it - cur.fi));
        }
      }
      else
      {
        auto it = lewo.lower_bound(cur.fi);
        if(SZ(lewo) > 0 && it != lewo.end())
        {
          auto cnt = gen({*it, cur.se}, k - 1);
          dorzuc(res, cnt, abs(*it - cur.fi));
        }
      }
    }

    if(lewo.count(cur.fi))
    {
      if(gora.count(cur.se))
      {
        auto it = dol.lower_bound(cur.se);
        if(SZ(dol) > 0 && it != dol.begin())
        {
          it--;
          auto cnt = gen({cur.fi, *it}, k - 1);
          dorzuc(res, cnt, abs(*it - cur.se));
        }
      }
      else
      {
        auto it = gora.lower_bound(cur.se);
        if(SZ(gora) > 0 && it != gora.begin())
        {
          it--;
          auto cnt = gen({cur.fi, *it}, k - 1);
          dorzuc(res, cnt, abs(*it - cur.se));
        }
      }
    }
    else
    {
      if(gora.count(cur.se))
      {
        auto it = dol.lower_bound(cur.se);
        if(SZ(dol) > 0 && it != dol.end())
        {
          auto cnt = gen({cur.fi, *it}, k - 1);
          dorzuc(res, cnt, abs(*it - cur.se));
        }
      }
      else
      {
        auto it = gora.lower_bound(cur.se);
        if(SZ(gora) > 0 && it != gora.end())
        {
          auto cnt = gen({cur.fi, *it}, k - 1);
          dorzuc(res, cnt, abs(*it - cur.se));
        }
      }
    }
  return res;

}

vector<pair<int, PII> > gen2(PII cur, int k = stala)
{

    vector<pair<int, PII> > res;
    res.pb({0, cur});
    if(k == 0)
      return res;

      if(dol.count(cur.se))
      {
        if(prawo.count(cur.fi))
        {
          auto it = lewo.lower_bound(cur.fi);
          if(SZ(lewo) > 0 && it != lewo.begin())
          {
            it--;
            auto cnt = gen2({*it, cur.se}, k - 1);
            dorzuc(res, cnt, abs(*it - cur.fi));
          }
        }
        else
        {
          auto it = prawo.lower_bound(cur.fi);
          if(SZ(prawo) > 0 && it != prawo.begin())
          {
            it--;
            auto cnt = gen2({*it, cur.se}, k - 1);
            dorzuc(res, cnt, abs(*it - cur.fi));
          }
        }
      }
      else
      {
        if(prawo.count(cur.fi))
        {
          auto it = lewo.lower_bound(cur.fi);
          if(SZ(lewo) > 0 && it != lewo.end())
          {
            auto cnt = gen2({*it, cur.se}, k - 1);
            dorzuc(res, cnt, abs(*it - cur.fi));
          }
        }
        else
        {
          auto it = prawo.lower_bound(cur.fi);
          if(SZ(prawo) > 0 && it != prawo.end())
          {
            auto cnt = gen2({*it, cur.se}, k - 1);
            dorzuc(res, cnt, abs(*it - cur.fi));
          }
        }
      }

      if(prawo.count(cur.fi))
      {
        if(dol.count(cur.se))
        {
          auto it = gora.lower_bound(cur.se);
          if(SZ(gora) > 0 && it != gora.begin())
          {
            it--;
            auto cnt = gen2({cur.fi, *it}, k - 1);
            dorzuc(res, cnt, abs(*it - cur.se));
          }
        }
        else
        {
          auto it = dol.lower_bound(cur.se);
          if(SZ(dol) > 0 && it != dol.begin())
          {
            it--;
            auto cnt = gen2({cur.fi, *it}, k - 1);
            dorzuc(res, cnt, abs(*it - cur.se));
          }
        }
      }
      else
      {
        if(dol.count(cur.se))
        {
          auto it = gora.lower_bound(cur.se);
          if(SZ(gora) > 0 && it != gora.end())
          {
            auto cnt = gen2({cur.fi, *it}, k - 1);
            dorzuc(res, cnt, abs(*it - cur.se));
          }
        }
        else
        {
          auto it = dol.lower_bound(cur.se);
          if(SZ(dol) > 0 && it != dol.end())
          {
            auto cnt = gen2({cur.fi, *it}, k - 1);
            dorzuc(res, cnt, abs(*it - cur.se));
          }
        }
      }
    return res;

}

int main()
{
	_upgrade
  int n, m, q;
  cin>>n>>m>>q;
  string s;
  cin>>s;
  for(int i = 0;i < SZ(s);i++)
    if(s[i] == 'E')
      prawo.insert(i + 1);
    else
      lewo.insert(i + 1);
  cin>>s;
  for(int i = 0;i < SZ(s);i++)
    if(s[i] == 'N')
      gora.insert(i + 1);
    else
      dol.insert(i + 1);
//  gen({4, 2});
  // cerr<<odl({4, 2}, {3, 2})<<endl;
 // return 0;
  while(q--)
  {
    PII start, meta;
    cin>>start.fi>>start.se;
    cin>>meta.fi>>meta.se;
    auto it = gen(start);
    auto it2 = gen2(meta);
/*
    for(auto s : it)
      cerr<<s.fi<<" "<<s.se.fi<<" "<<s.se.se<<endl;
    cerr<<endl;
    for(auto s : it2)
      cerr<<s.fi<<" "<<s.se.fi<<" "<<s.se.se<<endl;
      cerr<<endl;
      cerr<<endl;
      cerr<<endl;
      */
erase_duplicates(it);
erase_duplicates(it2);
    int res = inf;
    for(auto s : it)
      for(auto v : it2)
      {
  //      cerr<<s.fi<<" "<<v.fi<<" "<<odl(s.se, v.se)<<endl;
        res = min(res, odl(s.se, v.se) + s.fi + v.fi);
      }
    if(res == inf)
      cout<<"-1\n";
    else
      cout<<res<<"\n";
  }
	return 0;
}


Measured memory_bytes: 11856