//#pragma GCC optimize("O3,unroll-loops")
#include <vector>
//#pragma GCC target("avx2")
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define segl i*2+1, l, (r + l) / 2
#define segr i*2+2, (r + l) / 2, r

const long long MOD = 1e9 + 7;
const int maxn = 2e5 + 5;

template<typename T, typename K>
istream& operator>>(istream& a, pair<T, K>& b) {
    a >> b.first >> b.second;
    return a;
}

template<typename T>
istream& operator>>(istream& a, vector<T>& b) {
    for(auto&i : b)
        a >> i;
    return a;
}

template<typename T, typename K>
ostream& operator<<(ostream& a, pair<T, K>& b) {
    a << b.first << ' ' << b.second;
    return a;
}

template<typename T>
ostream& operator<<(ostream& a, vector<T>& b) {
    for(auto& i : b)
        a << i << ' ';
    return a;
}

/*
                               .
                              .#.
                             .z@z.
                            .z#@#z.
                           .z#@@@#z.
                          .z#@@@@@#z.
                            `^#@#^`
                              .@.
                              .@.
                            ._z@z_.
                        ._z@#^` `^#@z_.
                       @#^`         `^#@
                       @               @
                       @z_.         ._z@
                        `^#@z_.  ._z@#^`
                    ._z@#^` `^#@#^`  `^#@z_.
                ._z@#^`                    `^#@z_.
      ._z#z_. .@#^`                            `^#@.  ._z#z_.
    ._z###@@@#^`                                  `^#@@@@@###z_.
  ._z###@@@@@#^`                                  `^#@@@@@@###z_.
 ._z###@@@@@#^`                                    `^#@@@@@@@###z_.
.zz###@@###^^`                                      ``^^###@@@@@##zz..
 */

map<pair<int, int>, bool> mt;
vector<map<int, int>> fmn(1700), fmm(1700);
vector<pair<int, int>> a, b;
int n, m, k, N, M;

int nxPos(int cur, int fnd, int mxP, vector<pair<int, int>>& fndVec, vector<map<int, int>>& fndff) {
    int posCur = 0;
    int colPos = 0;
    while(colPos < cur) {
        colPos += fndVec[posCur].first;
        posCur++;
    }
    if(fndff[posCur].find(fnd) != fndff[posCur].end()) {
        int jmp = 1;
        int ss = fndff[posCur][fnd];
        for(int i = 0; i<ss-1; ++i) {
            jmp += fndVec[i].first;
        }
        //cout << cur << ' ' << jmp << " NEW JUMP" << endl;
        return jmp;
    }
    //cout << cur  << " NO JUMP " << endl;
    return mxP + 1;
}

bool dfs(int curA, int curB) {

    //cout << "NOW IN " << curA  << ' ' << curB << endl;

    if(curA == N+1 || curB == M+1) return 0;
    if(mt.find({curA, curB}) != mt.end()) {
        return  mt[{curA, curB}];
    }

    int cA = 0, cB = 0;
    int colcA = 0, colcB = 0;
    while(colcA < curA) {
        colcA += a[cA].first;
        cA++;
    }
    while(colcB < curB) {
        colcB += b[cB].first;
        cB++;
    }

    if(a[cA - 1].second != b[cB - 1].second) {
        int nextFir = nxPos(curA, b[cB - 1].second, N, a, fmn);
        int nextSec = nxPos(curB, a[cA - 1].second, M, b, fmm);
        //cout << "Wrong pos " << nextFir << ' ' << curB << ' ' << curA << ' ' << nextSec << endl;
        bool res = dfs(nextFir, curB) || dfs(curA, nextSec);
        mt[{curA, curB}] = res;
        return res;
    }

    bool res = 0;

    for(int i = 1; i<=k; ++i) {
        if(i == a[cA - 1].second) continue;
        if(fmn[cA].find(i) != fmn[cA].end() && fmm[cB].find(i) != fmm[cB].end()) {
            //cout << "Make jump " << endl;
            int aJump = 2;
            int bJump = 2;
            int nxA = fmn[cA][i], nxB = fmm[cB][i];
            for(int j = 0; j<nxA - 1; ++j) {
                aJump += a[j].first;
            }
            for(int j = 0; j<nxB - 1; ++j) {
                bJump += b[j].first;
            }
            res |= !dfs(aJump, bJump);
            if(res) break;
        }
    }

    int l = min(colcA - curA, colcB - curB) + 1;
    res |= !dfs(curA + 1, curB + 1);

    mt[{curA, curB}] = res;

    return res;
}

void solve() {
    int q;
    cin >> N >> n >> M >> m >> k >> q;
    a.resize(n); b.resize(m);
    cin >> a >> b;
    for(int i = n - 1; i >= 0; --i) {
        fmn[i] = fmn[i+1];
        //cout << "Added a jump to " << i + 1 << " on " << a[i].second << endl;
        fmn[i][a[i].second] = i+1;
    }
    for(int i = m - 1; i >= 0; --i) {
        fmm[i] = fmm[i+1];
        //cout << "Added b jump to " << i + 1 << " on " << a[i].second << endl;
        fmm[i][b[i].second] = i+1;
    }
    while(q--) {
        int u, v;
        cin >> u >> v;
        if(dfs(u + 1, v + 1)) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}
