#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

auto seed = chrono::high_resolution_clock().now().time_since_epoch().count();
mt19937 rnd(seed);

template<typename T>
using orderet_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename V>
using table = gp_hash_table<T, V>;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ld = long double;
using dd = double;

#define int ll

void solve(){
    int N, n, M, m, k, q;
    cin>>N>>n>>M>>m>>k>>q;
    vector<pair<int, int>> a(n);
    for(int i = 0; i < n; ++i) {
        cin>>a[i].first>>a[i].second;
        a[i].second--;
    }
    vector<pair<int, int>> b(m);
    for(int i = 0; i < m; ++i){
        cin>>b[i].first>>b[i].second;
        b[i].second--;
    }
    vector<int> A, B;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < a[i].first; ++j){
            A.push_back(a[i].second);
        }
    }
    for(int i = 0; i < m; ++i){
        for(int j = 0; j < b[i].first; ++j){
            B.push_back(b[i].second);
        }
    }
    vector<vector<int>> near_a(N, vector<int>(k, -1));
    vector<vector<int>> near_b(M, vector<int>(k, -1));
    for(int i = N-2; i >= 0; --i){
        near_a[i] = near_a[i+1];
        near_a[i][A[i + 1]] = i+1;
    }
    for(int i = M-2; i >= 0; --i){
        near_b[i] = near_b[i+1];
        near_b[i][B[i + 1]] = i+1;
    }
    vector<vector<int>> dp(N, vector<int>(M, 0));
    for(int i = N-1; i >= 0; --i){
        for(int j = M-1; j >= 0; --j){
            if(A[i] != B[j]) continue;
            for(int d =0 ; d < k; ++d){
                int x = near_a[i][d], y = near_b[j][d];
                if(x != -1 && y != -1 && dp[x][y] == 0){
                    dp[i][j] = 1;
                    break;
                }
            }
        }
    }
    while(q--){
        int C, D;
        cin>>C>>D;
        bool win = false;
        for(int d = 0; d < k; ++d){
            if(d == A[C]) continue;
            int x = near_a[C][d], y = near_b[D][d];
            if(x != -1 && y != -1 && dp[x][y] == 0){
                win = true;
                break;
            }
        }
        if(dp[C][D] == 0) win = true;
        if(win) cout << "Yes\n";
        else cout << "No\n";
    }
}

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