#include <bits/stdc++.h>
using ll = long long;
using namespace std;
vector <vector <int>> ans;
int k, N, M;
vector <int> a, b;
vector <vector <int>> pos_a, pos_b;

int count(int x, int y) {
    if (x >= N || y >= M) {
        return 0;
    }
    if (ans[x][y] != -1) return ans[x][y];
    int fl = 0;
    for (int t = 1; t <= k; t++) {
        int nx = (int) (lower_bound(pos_a[t].begin(), pos_a[t].end(), x) - pos_a[t].begin());
        if (nx >= (int) pos_a[t].size()) continue;
        int ny = (int) (lower_bound(pos_b[t].begin(), pos_b[t].end(), y) - pos_b[t].begin());
        if (ny >= (int) pos_b[t].size()) continue;
        if (!count(pos_a[t][nx] + 1, pos_b[t][ny] + 1)) fl = 1;
    }
    ans[x][y] = fl;
    return fl;
}


void solve() {
    int n, m, q; cin >> N >> n >> M >> m >> k >> q;
    pos_a.assign(k + 1, {});
    pos_b.assign(k + 1, {});
    for (int i = 0; i < n; i++) {
        int l, v; cin >> l >> v;
        for (int j = 0; j < l; j++) a.emplace_back(v);
    }
    for (int i = 0; i < m; i++) {
        int l, v; cin >> l >> v;
        for (int j = 0; j < l; j++) b.emplace_back(v);
    }
    for (int i = 0; i < N; i++) {
        pos_a[a[i]].emplace_back(i);
    }
    for (int i = 0; i < M; i++) {
        pos_b[b[i]].emplace_back(i);
    }
    ans.assign(N, vector <int>(M, -1));
    for (int i = 0; i < q; i++) {
        int x, y; cin >> x >> y;
        cout << (count(x, y) ? "Yes" : "No")<< endl;
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int test = 1;
    for (int i = 0; i < test; i++) {
        solve();
    }
}