#include <bits/stdc++.h>

using namespace std;

long long f(long long a, long long b) {
    return a * 1e9 + b;
}

unordered_map<long long, bool> ma;

vector<vector<int>> posa;
vector<vector<int>> posb;

vector<int> ba;
vector<int> bb;

vector<int> ca;
vector<int> cb;

int N, M, k;

int geta(long long a) {
    auto pos = (upper_bound(ba.begin(), ba.end(), a) - ba.begin() - 1);
    return pos;
}

int getb(long long b) {
    auto pos = (upper_bound(bb.begin(), bb.end(), b) - bb.begin() - 1);
    return pos;
}

void rec(long long a, long long b) {
    auto ia = geta(a);
    auto ib = getb(b);
    if (a >= N or b >= M) {
        ma[f(a, b)] = false;
        return;
    }
    if (ca[ia] == cb[ib]) {
        int res = min(ba[ia + 1] - a, bb[ib + 1] - b);
        if (res % 2 == 0) {
            ma[f(a, b)] = true;
            return;
        }
    }
    for (int i = 1; i <= k; i++) {
        int na, nb;
        if (ca[ia] == i) {
            na = a + 1;
        } else {
            if (posa[i].empty() or posa[i].back() <= a) continue;
            na = posa[i][(upper_bound(posa[i].begin(), posa[i].end(), a) - posa[i].begin())] + 1;
        }
        if (cb[ib] == i) {
            nb = b + 1;
        } else {
            if (posb[i].empty() or posb[i].back() <= b) continue;
            nb = posb[i][(upper_bound(posb[i].begin(), posb[i].end(), b) - posb[i].begin())] + 1;
        }
        if (ma.find(f(na, nb)) == ma.end()) rec(na, nb);
        if (!ma[f(na, nb)]) {
            ma[f(a, b)] = true;
            return;
        }
    }
    ma[f(a, b)] = false;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m, q;
    cin >> N >> n >> M >> m >> k >> q;
    ba.resize(n);
    bb.resize(m);
    ca.resize(n);
    cb.resize(m);
    posa.resize(k + 1);
    posb.resize(k + 1);
    int cu;

    cu = 0;
    for (int i = 0; i < n; i++) {
        int sz, x;
        cin >> sz >> x;
        ba[i] = cu;
        ca[i] = x;
        posa[x].push_back(cu);
        cu += sz;
    }

    cu = 0;
    for (int i = 0; i < m; i++) {
        int sz, x;
        cin >> sz >> x;
        bb[i] = cu;
        cb[i] = x;
        posb[x].push_back(cu);
        cu += sz;
    }


    ba.push_back(N);
    bb.push_back(M);
    for (int abab = 0; abab < q; abab++) {
        int a, b;
        cin >> a >> b;
        if (ma.find(f(a, b)) == ma.end()) rec(a, b);
        if (ma[f(a, b)]) cout << "Yes" << '\n';
        else cout << "No" << '\n';
    }
}
