#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll

void solve() {
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a(N + 1);
    vector<set<int>> pa(k + 1), pb(k + 1);
    int p = 1;
    for (int i = 0, l, x; i < n; i++) {
        cin >> l >> x;
        for (int j = 0; j < l; j++) {
            pa[x].insert(p);
            a[p++] = x;
        }
    }
    vector<int> b(M + 1);
    p = 1;
    for (int i = 0, l, x; i < n; i++) {
        cin >> l >> x;
        for (int j = 0; j < l; j++) {
            pb[x].insert(p);
            b[p++] = x;
        }
    }
    vector<vector<bool>> w(N + 1, vector<bool>(M + 1));
    for (int i = N; i >= 1; i--) {
        for (int j = M; j >= 1; j--) {
            if (a[i] != b[j])
                continue;
            for (int z = 1; z <= k; z++) {
                if (pa[z].upper_bound(i) != pa[z].end() && 
                    pb[z].upper_bound(j) != pb[z].end()) {
                    int ni = *pa[z].upper_bound(i);
                    int nj = *pb[z].upper_bound(j);
                    if (!w[ni][nj])
                        w[i][j] = 1;
                        break;
                }
            }
        }
    }
    for (int i = 0, x, y; i < q; i++) {
        cin >> x >> y;
        if (!w[x + 1][y + 1])
            cout << "Yes\n";
        else
            cout << "No\n";
    }
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    while (t--)
        solve();
}