#include <bits/stdc++.h>
#define int long long
#pragma ofast

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector <int> a, b;
    for (int i = 0; i < n; ++i) {
        int c, x;
        cin >> c >> x;
        for (int j = 0; j < c; ++j) {
            a.push_back(x - 1);
        }
    }
    for (int i = 0; i < m; ++i) {
        int c, x;
        cin >> c >> x;
        for (int j = 0; j < c; ++j) {
            b.push_back(x - 1);
        }
    }
    vector <vector <bool>> dp(N, vector <bool> (M, true));
    vector <int> maxwin(N);
    vector <vector <int>> nexta(N, vector <int> (k)), nextb(M, vector <int> (k));
    vector <int> lasta(k, -1), lastb(k, -1);
    for (int i = N - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j) {
            nexta[i][j] = lasta[j];
        }
        lasta[a[i]] = i;
    }
    for (int i = M - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j) {
            nextb[i][j] = lastb[j];
        }
        lastb[b[i]] = i;
    }
    for (int i = N - 1; i >= 0; --i) {
        for (int j = M - 1; j >= 0; --j) {
            if (a[i] != b[j]) continue;
            for (int x = 0; x < k; ++x) {
                if (nexta[i][x] != -1 && nextb[j][x] != -1 && dp[nexta[i][x]][nextb[j][x]]) {
                    dp[i][j] = false;
                    break;
                }
            }
        }
    }
    while (q--) {
        int i, j;
        cin >> i >> j;
        bool ans = dp[i][j];
        if (!ans) {
            for (int x = 0; x < k; ++x) {
                if (x != a[i] && nexta[i][x] != -1 && nextb[j][x] != -1 && dp[nexta[i][x]][nextb[j][x]]) {
                    ans = true;
                    break;
                }
            }
        }
        if (ans) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}
