#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <unordered_map>
using namespace std;

template<typename T1,typename T2>
istream&operator>>(istream&in,pair<T1,T2>&a){
    return in>>a.first>>a.second;
}
template<typename T1,typename T2>
ostream&operator<<(ostream&out,const pair<T1,T2>&a){
    return out<<a.first<<' '<<a.second<<'\n';
}
template<typename T>
istream&operator>>(istream&in,vector<T>&a){
    for (auto &i:a)in>>i;
    return in;
}
template<typename T>
ostream&operator<<(ostream&out,const vector<T>&a){
    for (const auto &i:a)out<<i<<' ';
    return out;
}
template<typename T>
ostream&operator<<(ostream&out,const vector<vector<T>>&a){
    for (const auto &i:a)out<<i<<'\n';
    return out;
}
typedef int ll;
const int inf =1e9+7;
void print(bool flag){
if (flag)cout<<"YES\n";
else cout<<"NO\n";
}
struct solve{
    int N,M,k;
    int n,m,q;
    vector<pair<int,int>>a;
    vector<pair<int,int>>b;
    vector<vector<int>>next1;
    vector<vector<int>>next2;
    vector<int>c;
    vector<int>d;
    unordered_map<int,int>mp;
    vector<vector<bool>>dp;
    solve(){
        cin>>N>>n>>M>>m>>k>>q;
        a.resize(n);
        b.resize(m);
        c.reserve(N);
        d.reserve(M);
        next1.resize(k,vector<int>(N,-1));
        next2.resize(k,vector<int>(M,-1));

        cin>>a>>b;
        for (auto &x:a)swap(x.first,x.second);
        for (auto &x:b)swap(x.first,x.second);
        for (auto &x:a)x.first--;
        for (auto &x:b)x.first--;
        for (auto [num,cnt]:a){
            while (cnt--){
                c.push_back(num);
            }
        }
        for (auto [num,cnt]:b){
            while (cnt--){
                d.push_back(num);
            }
        }
        for (int i=N-1;i>=0;i--){
            for (int j=0;j<k;j++){
                if (mp.find(j)!=mp.end())next1[j][i]=mp[j];
            }
            mp[c[i]]=i;
        }
        mp.clear();
        for (int i=M-1;i>=0;i--){
            for (int j=0;j<k;j++){
                if (mp.find(j)!=mp.end())next2[j][i]=mp[j];
            }
            mp[d[i]]=i;
        }
        dp.resize(N+1,vector<bool>(M+1,false));
        for (int i=N-1;i>=0;i--){
            for (int j=M-1;j>=0;j--){
                for (int l=0;l<k;l++){
                    if (next1[l][i]!=-1 && next2[l][j]!=-1){
                        if (!dp[next1[l][i]][next2[l][j]]){
                            dp[i][j]=true;
                            break;
                        }
                    }
                }
            }
        }
        while (q--){
            int x,y;
            cin>>x>>y;
            print(!dp[x][y]);
        }
    }
};
int main()
{
    int t=1;
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    while(t--)solve();
}
