#include <bits/stdc++.h>
using namespace std;
#define int long long
bool check(vector <int> &a, vector <int> &b, int k){
    unordered_set <int> da, db;
    for (auto x: a){
        da.insert(x);
    }
    bool f = 0;
    for (auto x: b){
        if (da.count(x)){
            f = 1;
            break;
        }
    }
    if (!f){
        return false;
    }
    map <int, int> inda, indb;
    for (int i = 0; i < a.size(); ++i){
        if (!inda[a[i]]){
            inda[a[i]] = i + 1;
        }
    }
    for (int i = 0; i < b.size(); ++i){
        if (!indb[b[i]]){
            indb[b[i]] = i + 1;
        }
    }
    for (int i = 1; i <= k; ++i){
        if (inda[i] && indb[i]){
            vector <int> c, d;
            for (int j = inda[i]; j < a.size(); ++j){
                c.push_back(a[j]);
            }
            for (int j = indb[i]; j < b.size(); ++j){
                d.push_back(b[j]);
            }
            bool f = check(c, d, k);
            if (!f){
                return true;
            }
        }
    }
    return false;
}
void solve(){
    int n, n1, m, m1, k, q;
    cin >> n >> n1 >> m >> m1 >> k >> q;
    vector <pair <int, int>> a1(n1);
    for (int i = 0; i < n1; ++i){
        cin >> a1[i].first >> a1[i].second;
    }
    vector <pair <int, int>> b1(m1);
    for (int i = 0; i < m1; ++i){
        cin >> b1[i].first >> b1[i].second;
    }
    vector <int> a, b;
    for (int i = 0; i < n1; ++i){
        for (int j = 0; j < a1[i].first; ++j){
            a.push_back(a1[i].second);
        }
    }
    for (int i = 0; i < m1; ++i){
        for (int j = 0; j < b1[i].first; ++j){
            b.push_back(b1[i].second);
        }
    }
    while (q--){
        int x, y;
        cin >> x >> y;
        vector <int> c, d;
        for (int j = x; j < a.size(); ++j){
            c.push_back(a[j]);
        }
        for (int j = y; j < b.size(); ++j){
            d.push_back(b[j]);
        }
        bool ans = check(c, d, k);
        if (ans){
            cout << "Yes\n";
        }
        else{
            cout << "No\n";
        }
    }
}
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--){
        solve();
    }
}


