#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;
struct fenw {
    vector<int> f;
    explicit fenw(int n) {
        f.resize(n);
    }
    void upd(int i, int x) {
        while (i < f.size()) {
            f[i] += x;
            i |= (i + 1);
        }
    }
    int get(int i) {
        int sum = 0;
        while (i >= 0) {
            sum += f[i];
            i %= (i + 1);
            i--;
        }
        return sum;
    }
};
template <typename T>
bool smin(T& a, T b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool smax(T& a, T b) {
    if (b > a) {
        a = b;
        return true;
    }
    return false;
}

vector<int> prefa, prefb;
vector<vector<int>> cnt, cntw;
int n, m;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a;
    vector<int> b;
    prefa.resize(n + 1);
    prefb.resize(m + 1);
    for (int i = 0; i < n; i++) {
        int l, x;
        cin >> l >> x;
        prefa[i + 1] = prefa[i] + l;
        while (l--) a.push_back(x);
    }
    for (int i = 0; i < m; i++) {
        int l, x;
        cin >> l >> x;
        prefb[i + 1] = prefb[i] + l;
        while (l--) b.push_back(x);
    }
    cntw = cnt = vector<vector<int>> (N + 1, vector<int> (M + 1, 0));
    vector<vector<int>> nexta(N, vector<int> (k + 1));
    vector<vector<int>> nextb(M, vector<int> (k + 1));
    vector<int> cur(k + 1, N);
    for (int i = N - 1; i >= 0; i--) {
        cur[a[i]] = i;
        for (int j = 0; j <= k; j++) nexta[i][j] = cur[j];
    }
    cur.assign(k + 1, M);
    for (int i = M - 1; i >= 0; i--) {
        cur[b[i]] = i;
        for (int j = 0; j <= k; j++) nextb[i][j] = cur[j];
    }
    for (int i = N - 1; i >= 0; i--) {
        int curor = 0;
        for (int j = M - 1; j >= 0; j--) {
//            int ii = a[i];
//            if (nexta[i][ii] != N && nextb[j][ii] != M) {
//                cnt[i][j] |= (1 - cnt[nexta[i][ii] + 1][nextb[j][ii] + 1]);
//            }
//            ii = b[j];
//            if (nexta[i][ii] != N && nextb[j][ii] != M) {
//                cnt[i][j] |= (1 - cnt[nexta[i][ii] + 1][nextb[j][ii] + 1]);
//            }
//            cnt[i][j] |= curor;
//            if (j != 0 && b[j - 1] != b[j]) {
//                if (nexta[i][b[j]] != N) {
//                    curor |= (1 - cnt[nexta[i][b[j]] + 1][j + 1]);
//                }
//            }
            for (int ii = 0; ii <= k; ii++) {
                if (nexta[i][ii] != n && nextb[j][ii] != m) {
                    cnt[i][j] |= (1 - cnt[nexta[i][ii] + 1][nextb[j][ii] + 1]);
                }
            }
        }
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (cnt[x][y]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
    return 0;
}