//#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;
vector<int> aSums, bSums;
int n, m, k, N, M;

int nxPos(int cur, int fnd, int mxP, vector<pair<int, int>>& fndVec, vector<map<int, int>>& fndff, vector<int>& sums) {
    int posCur = upper_bound(sums.begin(), sums.end(), cur - 1) - sums.begin();
    if(fndVec[posCur-1].second == fnd) return cur;
    if(fndff[posCur].find(fnd) != fndff[posCur].end()) {
        int jmp = sums[fndff[posCur][fnd] - 1] + 1;
        //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 <= 0 || curB <= 0) exit(228);
    if(curA >= N+1 || curB >= M+1) return 0;
    if(mt.find({curA, curB}) != mt.end()) {
        return  mt[{curA, curB}];
    }

    int cA = upper_bound(aSums.begin(), aSums.end(), curA - 1) - aSums.begin(), cB = upper_bound(bSums.begin(), bSums.end(), curB - 1) - bSums.begin();
    int colcA = aSums[cA], colcB = aSums[cB];

    bool res = 0;

    for(int i = 1; i<=k; ++i) {
        if(i == a[cA - 1].second && i == b[cB - 1].second) continue;
        int aJump = nxPos(curA, i, N, a, fmn, aSums);
        int bJump = nxPos(curB, i, M, b, fmm, bSums);
        if(aJump > N) continue;
        if(bJump > M) continue;
        if(aJump + 1 <= curA || bJump + 1 <= curB) exit(228);
        //cout << "DO JUMP IN " << aJump + 1 << ' ' << bJump + 1 << ' ' << curA << ' ' << curB << endl;
        res |= !dfs(aJump + 1, bJump + 1);
    }

    if(a[cA - 1].second == b[cB - 1].second) {
        res |= !dfs(curA + 1, curB + 1);
    }

    mt[{curA, curB}] = res;

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

    return res;
}
//
void solve() {
    int q;
    cin >> N >> n >> M >> m >> k >> q;
    a.resize(n); b.resize(m);
    aSums.resize(n + 1, 0); bSums.resize(m + 1, 0);
    cin >> a >> b;
    for(int i = 0; i<n; ++i) {
        aSums[i + 1] += aSums[i];
        aSums[i + 1] += a[i].first;
    }
    for(int i = 0; i<m; ++i) {
        bSums[i + 1] += bSums[i];
        bSums[i + 1] += b[i].first;
    }
    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;
}
