#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
constexpr int INF = 1e18;
constexpr int MOD = 1e9 + 7;
//mt19937_64 rnd(0);

vector<int> a, b;
vector<vector<int>> nxta;
vector<vector<int>> nxtb;
vector<vector<int>> res;
int N, M, k;

bool go(int ia, int ib) {
    if (ia == N || ib == M) {
        return false;
    }
    if (res[ia][ib] != 2) {
        return res[ia][ib];
    }
    for (int i = 0; i < k; ++i) {
        if (!go(nxta[ia][i] + 1, nxtb[ib][i] + 1)) {
            res[ia][ib] = 1;
            return true;
        }
    }
    res[ia][ib] = 0;
    return false;
}


void solve() {
    int n, m, q;
    cin >> N >> n >> M >> m >> k >> q;
    a.assign(N, {});
    b.assign(M, {});
    nxta.assign(N, vector<int> (k, N));
    nxtb.assign(M, vector<int> (k, M));
    res.assign(N, vector<int>(M, 2));
    int ia = 0;
    int ib = 0;
    for (int i = 0; i < n; ++i) {
        int l, v;
        cin >> l >> v;
        v--;
        for (int j = 0; j < l; ++j) {
            a[ia] = v;
            ia++;
        }
    }
    for (int i = 0; i < m; ++i) {
        int l, v;
        cin >> l >> v;
        v--;
        for (int j = 0; j < l; ++j) {
            b[ib] = v;
            ib++;
        }
    }
    for (int i = N - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j) {
            nxta[i][j] = nxta[i + 1][j];
        }
        nxta[i][a[i]] = i;
    }
    for (int i = M - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j) {
            nxtb[i][j] = nxtb[i + 1][j];
        }
        nxtb[i][b[i]] = i;
    }
    for (int i = 0; i < q; ++i) {
        cin >> ia >> ib;
        if (go(ia, ib)) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
#ifdef MULTY
    cin >> t;
#endif
    while (t--) {
        solve();
    }

    return 0;
}