#include <bits/stdc++.h>

using namespace std;

using ll = long long;

void solve() {
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a;
    for (int i = 0; i < n; i++) {
        int la, va;
        cin >> la >> va;
        va--;
        for (int j = 0; j < la; j++) {
            a.push_back(va);
        }
    }
    vector<int> b;
    for (int i = 0; i < m; i++) {
        int lb, vb;
        cin >> lb >> vb;
        vb--;
        for (int j = 0; j < lb; j++) {
            b.push_back(vb);
        }
    }
    vector<vector<int>> na(N, vector<int> (k, N));
    na[N - 1][a[N - 1]] = N - 1;
    int mina = N;
    for (int i = N - 2; i >= 0; i--) {
        na[i] = na[i + 1];
        if (na[i][a[i]] == N) {
            mina = i;
        }
        na[i][a[i]] = i;
    }
    vector<vector<int>> nb(M, vector<int> (k, M));
    nb[M - 1][b[M - 1]] = M - 1;
    int minb = M;
    for (int i = M - 2; i >= 0; i--) {
        nb[i] = nb[i + 1];
        if (nb[i][b[i]] == M) {
            minb = i;
        }
        nb[i][b[i]] = i;
    }
    vector<vector<int>> dp(N, vector<int> (M));
    for (int i = N - 1; i >= 0; i--) {
        for (int j = M - 1; j >= 0; j--) {
            if (a[i] != b[j]) continue;
            for (int l = 0; l < k; l++) {
                if (i == N - 1 || j == M - 1 || na[i + 1][l] > N - 1 || nb[j + 1][l] > M - 1) {
                    continue;
                }
                if (!dp[na[i + 1][l]][nb[j + 1][l]]) {
                    dp[i][j] = 1;
                    break;
                }
            }
        }
    }
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y;
        if (!dp[x][y]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}

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

    int t = 1;
    for (int i = 0; i < t; i++) solve();
}
