#ifndef LOCAL
#pragma GCC optimize("O3")
#endif

#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;
using oset = tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;
const ll nMax = 5010;
bool dp[nMax][nMax];
int nxt1[nMax], nxt2[nMax];
bool canMove[nMax];
bool ans[nMax][nMax];
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin.tie(0)->sync_with_stdio(0);
    ll N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a, b;
    for (int i = 0; i < n; i++) {
        int l, v;
        cin >> l >> v;
        for (int i = 0; i < l; i++)a.push_back(v);
    }
    for (int i = 0; i < m; i++) {
        int l, v;
        cin >> l >> v;
        for (int i = 0; i < l; i++)b.push_back(v);
    }
    memset(nxt1, -1, sizeof nxt1);
    for (int j = N - 1; j >= 0; j--) {
        set<int>  lose;
        int num = a[j];
        memset(nxt2, -1, sizeof nxt2);
        for (int i = M - 1; i >= 0; i--) {
            if (a[j] != b[i]) {
                lose.erase(b[i]);
                if((nxt1[b[i]] != -1 && !dp[nxt1[b[i]]][i]))lose.insert(b[i]);
                nxt2[b[i]]=i;
                continue;
            }
            if(lose.size())ans[j][i]=true;
            if(lose.size() || (nxt1[num] != -1 && nxt2[num] != -1 && !dp[nxt1[num]][nxt2[num]]))
                dp[j][i] = 1;
            else ans[j][i] = 1;
            nxt2[num]=i;
        }
        int lst = -1;
        for(int i = 0; i < M; i++){
            if(a[j] == b[i])lst = i;
        }
        for(; lst >=0 && !canMove[lst] ; lst--)canMove[lst] = true;
        nxt1[a[j]] = j;
    }
    for(int i = 0; i < q; i++){
        int l,r;
        cin >> l >> r;
        cout << (ans[l][r] ? "Yes" : "No") << '\n';
    }
}