#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)), dp2(N + 1, vector<int>(M + 1));
    for (int i = 0; i <= N; ++i) {
        dp[i][M] = 1;
    }
    for (int i = 0; i <= M; ++i) {
        dp[N][i] = 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<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 (a[i] == b[j]) {
                int v = a[i];
                if (nxta[v] != N && nxtb[v] != M && dp[nxta[v]][nxtb[v]]) {
                    dp2[i][j] = 1;
                }
                for (int g = 0; g < k; ++g) {
                    if (clock() * 1.0 / CLOCKS_PER_SEC >= 2.45) break;
                    if (nxta[g] == N || nxtb[g] == M) continue;
                    dp[i][j] |= !dp[nxta[g]][nxtb[g]];
                }
                for (int g = 0; g < k; ++g) {
                    if (clock() * 1.0 / CLOCKS_PER_SEC >= 2.45) break;
                    if (g == a[i] || nxta[g] == N || nxtb[g] == M) continue;
                    dp2[i][j] |= !dp[nxta[g]][nxtb[g]];
                }
                dp2[i][j] |= !dp[i][j];
            }
            nxtb[b[j]] = j;
        }
        nxta[a[i]] = i;
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        cout << (dp2[x][y] ? "Yes\n" : "No\n");
    }
}

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