#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
//#define int long long

const int f = 5010;
int dp[f][f];

void solve() {
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a, b, was;
    vector<vector<int>> a1, b1;
    for (int i = 0; i < n; ++i) {
        int kol, x;
        cin >> kol >> x;
        while (kol--) {
            a.pb(x);
        }
        was.pb(x);
    }
    for (int i = 0; i < n; ++i) {
        int kol, x;
        cin >> kol >> x;
        while (kol--) {
            b.pb(x);
        }
        was.pb(x);
    }
    sort(all(was));
    was.resize(unique(all(was)) - was.begin());
    map<int, int> t;
    for (int i = 0; i < sz(was); ++i) {
        t[was[i]] = i;
    }
    for (int& i : a) {
        i = t[i];
    }
    for (int& i : b) {
        i = t[i];
    }
    a1.resize(N, vector<int> (sz(was), N));
    b1.resize(M, vector<int> (sz(was), M));
    for (int i = N - 1; i >= 0; --i) {
        if (i != N - 1) {
            a1[i] = a1[i + 1];
        }
        a1[i][a[i]] = i;
    }
    for (int i = M - 1; i >= 0; --i) {
        if (i != M - 1) {
            b1[i] = b1[i + 1];
        }
        b1[i][b[i]] = i;
    }
    for (int i = N - 1; i >= 0; --i) {
        for (int j = M - 1; j >= 0; --j) {
            bool prov = false;
            for (int o = 0; o < sz(was); ++o) {
                if (a1[i][o] < N && b1[j][o] < M) {
                    if (!dp[a1[i][o] + 1][b1[j][o] + 1]) {
                        prov = true;
                        break;
                    }
                }
            }
            if (prov) {
                dp[i][j] = 1;
            }
        }
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (dp[x][y]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
