#include <bits/stdc++.h>

using namespace std;

void solve();

//#pragma GCC optimize("O3","Ofast","fastmath","unroll-loops")
//#pragma GCC target("avx2","sse4.2","bmi","lzcnt","popcnt")
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
   // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

#define int long long
#define endl '\n'
const int N = 300 + 1, INF = 2e9, MOD = 1e9 + 7;

bool dp[N][N];
int nxa[N][1601];
int nxb[N][1601];
void solve() {
    int nb,n,mb,m,k,q;
    cin>>nb>>n>>mb>>m>>k>>q;

    vector<int> a,b;
    for(int i=0;i<n;i++){
        int f,s;
        cin>>f>>s;
        while(f--){
            a.push_back(s);
        }
    }
    map<int,int> prev;
    for(int i=nb-1;i>=0;i--){
        prev[a[i]]=i;
        for(int j=0;j<=k;j++){
            if(!prev.count(j)){
                nxa[i][j]=nb;
            }else {
                nxa[i][j] = prev[j];
            }
        }
    }

    for(int i=0;i<m;i++){
        int f,s;
        cin>>f>>s;
        while(f--){
            b.push_back(s);
        }
    }
    prev.clear();
    for(int i=mb-1;i>=0;i--){
        prev[b[i]]=i;
        for(int j=0;j<=k;j++){
            if(!prev.count(j)){
                nxb[i][j]=mb;
            }else {
                nxb[i][j] = prev[j];
            }
        }
    }
    for(int i=0;i<=nb;i++){
        dp[i][mb]=false;
    }
    for(int i=0;i<=mb;i++){
        dp[nb][i]=false;
    }
    auto cdp=&dp;
    for(int i=nb-1;i>=0;i--){
        for(int j=mb-1;j>=0;j--){
            for(int elem=0;elem<=k;elem++){
                int ni=nxa[i][elem],nj=nxb[j][elem];
                if(ni>=nb || nj>=mb)continue;
                if(!dp[ni+1][nj+1]){
                    dp[i][j]=true;
                    break;
                }
            }
        }
    }
    while(q--){
        int x,y;
        cin>>x>>y;
        if(dp[x][y]){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
}