#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("02")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

const int NN = 5003;
int dp[NN][NN][2];
int nxta[NN][1603], nxtb[NN][1603];
int ii[1603][NN], jj[1603][NN];
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    for (int i = 1; i <= k; i++){
        fill(ii[i], ii[i] + NN, -1);
        fill(jj[i], jj[i]+NN, -1);
    }
    for (int i = 0; i < NN; i++){
        fill(nxta[i], nxta[i] + k + 1, -1);
        fill(nxtb[i], nxtb[i] + k + 1, -1);
    }
    vector<int> aa, bb;
    for (int i = 0; i < n; i++) {
        int c, v;
        cin >> c >> v;
        for (int j = 0; j < c; j++){
            aa.push_back(v);
        }
    }
    for (int i = 0; i < m; i++){
        int c, v;
        cin >> c >> v;
        for (int j = 0; j < c; j++){
            bb.push_back(v);
        }
    }
    for (int i = N - 2; i >= 0; i--){
        for (int j = 0; j <= k; j++){
            nxta[i][j] = nxta[i + 1][j];
        }
        nxta[i][aa[i + 1]] = i + 1;
    }
    for (int i = M - 2; i >= 0; i--){
        for (int j = 0; j <= k; j++){
            nxtb[i][j] = nxtb[i + 1][j];
        }
        nxtb[i][bb[i + 1]] = i + 1;
    }
    for (int i = N - 1; i >= 0; i--){
        for (int j = M - 1; j >= 0; j--){
            bool was1 = false, was2 = true;
            for (int now = 1; now <= k; now++){
                //cout << i << " " << j << " " << nxta[i][now] << " " << nxtb[i][now] << " " << now << "\n";
                if (nxta[i][now] == -1 || nxtb[j][now] == -1){
                    continue;
                } else {
                    was1 |= dp[nxta[i][now]][nxtb[j][now]][1];
                    was2 &= dp[nxta[i][now]][nxtb[j][now]][0];
                }
            }
            //cout << was1 << " " << was2 << "\n";
            dp[i][j][0] = was1;
            dp[i][j][1] = was2;
        }
    }
    vector<vector<int>> fa(k + 1), fb(k + 1);
    for (int i = 0; i < N; i++){
        fa[aa[i]].push_back(i);
    }
    for (int i = 0; i < M; i++){
        fb[bb[i]].push_back(i);
    }
    vector<pair<int, int>> z;
    vector<int> x, y;
    while (q--){
        int x0, y0;
        cin >> x0 >> y0;
        z.push_back({x0, y0});
        x.push_back(x0);
        y.push_back(y0);
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    x.resize(distance(x.begin(), unique(x.begin(), x.end())));
    y.resize(distance(y.begin(), unique(y.begin(), y.end())));
    for (int j =1; j <= k; j++){
        int now = 0;
        for (auto el : fa[j]){
            while (now < x.size() && x[now] <= el){
                ii[j][x[now]] = el;
                now++;
            }
        }
        now = 0;
        for (auto el : fb[j]){
            while (now < y.size() && y[now] <= el){
                jj[j][y[now]] = el;
                now++;
            } 
        }
    }
    for (auto [xx, yy] : z){
        bool ans = false;

        for (int j = 1; j <= k; j++){
            auto it1 = ii[j][xx];
            auto it2 =jj[j][yy];
            if (it1 != -1 && it2 != -1){
                ans |= dp[it1][it2][1];
            }
        }
        if (ans){
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}
/*
6 6
1 1 1 4 5
2 3 4 5 6 1
1 2 3 4 5 6

 */