#include<bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,bmi,bmi2,sse,sse2,sse3,sse4")
using namespace std;
bitset<5001>dp[5001];
bitset<5001>was[5001];
int nxta[5002][1601];
int nxtb[5002][1601];
int n, m, k;
bool rec(int x, int y) {
    if (x > n || y > m) {
        return 1;
    }
    if (was[x][y]) {
        return dp[x][y];
    }
    was[x][y] = 1;
    for (int i = 1; i <= k; i++) {
        if (!rec(nxta[x + 1][i], nxtb[y + 1][i])) {
            dp[x][y] = 1;
        }
    }
    return dp[x][y];
}
void gogo() {
    int nn, mm, q;
    cin >> n >> nn >> m >> mm >> k >> q;
    int sum = 0;
    int a[n + 1] = {};
    for (int i = 1; i <= nn; i++) {
        int l, v;
        cin >> l >> v;
        for (int i = 1; i <= l; i++) {
            a[++sum] = v;
        }
    }
    sum = 0;
    int b[m + 1] = {};
    for (int i = 1; i <= mm; i++) {
        int l, v;
        cin >> l >> v;
        for (int i = 1; i <= l; i++) {
            b[++sum] = v;
        }
    }
    int lsta[k + 1] = {};
    fill(lsta + 1, lsta + k + 1, INT_MAX);
    for (int j = 1; j <= k; j++) {
        nxta[n + 1][j] = lsta[j];
    }
    for (int i = n; i >= 1; i--) {
        lsta[a[i]] = i;
        for (int j = 1; j <= k; j++) {
            nxta[i][j] = lsta[j];
        }
    }
    int lstb[k + 1] = {};
    fill(lstb + 1, lstb + k + 1, INT_MAX);
    for (int j = 1; j <= k; j++) {
        nxtb[m + 1][j] = lstb[j];
    }
    for (int i = m; i >= 1; i--) {
        lstb[b[i]] = i;
        for (int j = 1; j <= k; j++) {
            nxtb[i][j] = lstb[j];
        }
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        cout << (rec(x, y) ? "Yes" : "No") << "\n";
    }
}
main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--) {
        gogo();
    }
}
//0 62 100(?82) 69
//min 213
//max 231