#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];
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 = 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);
    }
    while (q--){
        int x0, y0;
        cin >> x0 >> y0;
        bool ans = false;

        for (int j = 1; j <= k; j++){
            auto it1 = lower_bound(fa[j].begin(), fa[j].end(), x0);
            auto it2 = lower_bound(fb[j].begin(), fb[j].end(), y0);
            if (it1 != fa[j].end() && it2 != fb[j].end()){
                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
 */