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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

const ll INF = TEN(18);

int main() {
    int N, M, Q;
    string S, T;
    cin >> N >> M >> Q >> S >> T;
    debug(S, T);
    V<int> vw, ve, vn, vs;
    rep(i, N) {
        if (S[i] == 'W') {
            vw.pb(i);
        } else {
            ve.pb(i);
        }
    }
    rep(i, M) {
        if (T[i] == 'N') {
            vn.pb(i);
        } else {
            vs.pb(i);
        }
    }
    while (Q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        --a, --b, --c, --d;
        V<int> xs{a, c}, ys{b, d};
        for (int x : {a, c}) {
            if (S[x] == 'E') {
                auto it = lower_bound(ALL(vw), x);
                if (it != vw.end()) {
                    xs.pb(*it);
                }
                if (it != vw.begin()) {
                    --it;
                    xs.pb(*it);
                }
            } else {
                auto it = lower_bound(ALL(ve), x);
                if (it != ve.end()) {
                    xs.pb(*it);
                }
                if (it != ve.begin()) {
                    --it;
                    xs.pb(*it);
                }
            }
        }
        for (int y : {b, d}) {
            if (T[y] == 'N') {
                auto it = lower_bound(ALL(vs), y);
                if (it != vs.end()) {
                    ys.pb(*it);
                }
                if (it != vs.begin()) {
                    --it;
                    ys.pb(*it);
                }
            } else {
                auto it = lower_bound(ALL(vn), y);
                if (it != vn.end()) {
                    ys.pb(*it);
                }
                if (it != vn.begin()) {
                    --it;
                    ys.pb(*it);
                }
            }
        }
        sort(ALL(xs));
        xs.erase(unique(ALL(xs)), xs.end());
        sort(ALL(ys));
        ys.erase(unique(ALL(ys)), ys.end());
        debug(xs, ys);

        a = lower_bound(ALL(xs), a) - xs.begin();
        b = lower_bound(ALL(ys), b) - ys.begin();
        c = lower_bound(ALL(xs), c) - xs.begin();
        d = lower_bound(ALL(ys), d) - ys.begin();

        using Data = pair<ll, pii>;
        priority_queue<Data, V<Data>, greater<Data>> que;
        VV<ll> ds(xs.size(), V<ll>(ys.size(), INF));
        ds[a][b] = 0;
        que.push(mp(0, mp(a, b)));
        while (!que.empty()) {
            auto t = que.top();
            que.pop();
            int x, y;
            tie(x, y) = t.se;
            if (ds[x][y] < t.fi) continue;

            if (T[ys[y]] == 'S') {
                for (int nx = x + 1; nx < xs.size(); ++nx) {
                    ll nd = ds[x][y] + abs(xs[nx] - xs[x]);
                    if (ds[nx][y] > nd) {
                        ds[nx][y] = nd;
                        que.push(mp(nd, mp(nx, y)));
                    }
                }
            } else {
                for (int nx = x - 1; nx >= 0; --nx) {
                    ll nd = ds[x][y] + abs(xs[nx] - xs[x]);
                    if (ds[nx][y] > nd) {
                        ds[nx][y] = nd;
                        que.push(mp(nd, mp(nx, y)));
                    }
                }
            }
            if (S[xs[x]] == 'E') {
                for (int ny = y + 1; ny < ys.size(); ++ny) {
                    ll nd = ds[x][y] + abs(ys[ny] - ys[y]);
                    if (ds[x][ny] > nd) {
                        ds[x][ny] = nd;
                        que.push(mp(nd, mp(x, ny)));
                    }
                }
            } else {
                for (int ny = y - 1; ny >= 0; --ny) {
                    ll nd = ds[x][y] + abs(ys[ny] - ys[y]);
                    if (ds[x][ny] > nd) {
                        ds[x][ny] = nd;
                        que.push(mp(nd, mp(x, ny)));
                    }
                }
            }
        }
        ll ans = ds[c][d];
        if (ans == INF) ans = -1;
        cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 2748