//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
//#pragma GCC target("avx, avx2, tune=native")
#define int long long
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define pi pair<int, int>


using namespace std;

void solve() {
    int N, M, n, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<vector<int>> dp(N + 1, vector<int>(M + 1));
    vector<int> a, b;
    for (int i = 0; i < n; ++i) {
        int l, v;
        cin >> l >> v;
        --v;
        for (int j = 0; j < l; ++j) {
            a.push_back(v);
        }
    }

    for (int i = 0; i < m; ++i) {
        int l, v;
        cin >> l >> v;
        --v;
        for (int j = 0; j < l; ++j) {
            b.push_back(v);
        }
    }
    vector<vector<int>> na(N + 1 , vector<int>(k, N)), nb(M + 1, vector<int>(k, M));
    for (int i = N - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j) {
            if (j == a[i]) {
                na[i][j] = i;
            } else {
                na[i][j] = na[i + 1][j];
            }
        }
    }

    for (int i = M - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j) {
            if (j == b[i]) {
                nb[i][j] = i;
            } else {
                nb[i][j] = nb[i + 1][j];
            }
        }
    }

    vector<int> nxta(k, N);
    for (int i = N - 1; i >= 0; --i) {
        vector<int> nxtb(k, M);
        vector<int> was(k);
        for (int j = M - 1; j >= 0; --j) {
            if (i + 1 == N || j + 1 == M) {
                dp[i][j] = 0;
            } else {
                int va = a[i + 1];
                int vb = b[j + 1];
                if (va == vb) {
                    dp[i][j] |= !dp[i + 1][j + 1];
                }
                if (nxta[vb] != N) {
                    dp[i][j] |= !dp[nxta[vb]][j + 1];
                }
                if (nxtb[va] != M) {
                    dp[i][j] |= !dp[i + 1][nxtb[va]];
                }
                dp[i][j] |= !dp[i + 1][j];
                dp[i][j] |= !dp[i][j + 1];
            }
            nxtb[b[j]] = j;
        }
        nxta[a[i]] = i;
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        bool res = false;
        res |= !dp[x][y];
        for (int g = 0; g < k; ++g) {
            if (g == a[x] || na[x][g] == N || nb[y][g] == M) continue;
            res |= !dp[na[x][g]][nb[y][g]];
        }
        cout << (res ? "Yes\n" : "No\n");
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
}