#include <bits/stdc++.h>
#include <immintrin.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;

const int N = 1100;

random_device rd;

mt19937 rnd(rd());

void solve(){
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a(N), b(M);
    vector<int> la(n), lb(m);
    int now = 0;
    for(int i = 0; i < n; i++){
        int l, v;
        cin >> l >> v;
        v--;
        while(l--){
            a[now++] = v;
        }
    }
    now = 0;
    for(int i = 0; i < m; i++){
        int l, v;
        cin >> l >> v;
        v--;
        while(l--){
            b[now++] = v;
        }
    }
    vector<vector<int>> dp(N + 1, vector<int>(M + 1));
    for(int i = N - 1; i >= 0; i--){
        for(int j = M - 1; j >= 0; j--){
            if(a[i] == b[j]){
                if(!dp[i + 1][j + 1]){
                    dp[i][j] = 1;
                }
            }else{
                dp[i][j] = (dp[i][j + 1] || dp[i + 1][j]);
            }
        }
    }
    while(q--){
        int x, y;
        cin >> x >> y;
        if(dp[x][y]){
            cout << "Yes\n";
        }else{
            cout << "No\n";
        }
    }
}

signed main(){
#ifdef lisie_bimbi
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    cin.tie(nullptr)->sync_with_stdio(false);
#endif            
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}