#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int maxn = 1605;

bool dp[maxn][maxn];
bool dpb[maxn][maxn];

vector<int> inda[maxn],indb[maxn];
vector<pair<int,int>> posa,posb;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N,n,M,m,k,q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<pair<int,int>> a,b;
    int tposa = 0,tposb = 0;
    for(int j = 0;j < n;++j)
    {
        int l,v;
        cin >> l >> v;
        a.push_back({l,v});
        posa.push_back({tposa,j});
        tposa += l;
        inda[v].push_back(j);
    }
    for(int j = 0;j < m;++j)
    {
        int l,v;
        cin >> l >> v;
        b.push_back({l,v});
        posb.push_back({tposb,j});
        tposb += l;
        indb[v].push_back(j);
    }
    for(int j = n;j >= 0;--j)
    {
        for(int k = m;k >= 0;--k)
        {
            if(j == n || k == m)
            {
                dp[j][k] = 0;
                dpb[j][k] = 0;
            }
            else if(a[j].second == b[k].second)
            {
                for(int ne = 1;ne <= k;++ne)
                {
                    if(ne != a[j].second)
                    {
                        int bla = lower_bound(inda[ne].begin(),inda[ne].end(),j)-inda[ne].begin();
                        int blb = lower_bound(indb[ne].begin(),indb[ne].end(),j)-indb[ne].begin();
                        if(bla != inda[ne].size() && blb != indb[ne].size() && dp[bla][blb])
                        {
                            dpb[j][k] = 1;
                        }
                    }
                }
                if(dpb[j][k] == 1)
                {
                    dp[j][k] = 1;
                }
                else
                {
                    int ee = a[j].second;
                    int tlena = a[j].first,tlenb = b[k].first,ia = lower_bound(inda[ee].begin(),inda[ee].end(),j)-inda[ee].begin();
                    int ib = lower_bound(indb[ee].begin(),indb[ee].end(),k)-indb[ee].begin();
                    int mv = 1;
                    while(true)
                    {
                        if(dpb[inda[ee][ia]][inda[ee][ib]] == 1)
                        {
                            dp[j][k] = (mv == 1 ? 1 : 0);
                            break;
                        }
                        else if(tlena == tlenb)
                        {
                            if(ib+1 == indb[ee].size() || ia+1 == inda[ee].size())
                            {
                                dp[j][k] = (tlena % 2 == 1 ? (mv == 1 ? 1 : 0) : (mv == 1 ? 0 : 1));
                                break;
                            }
                            else
                            {
                                ia++;
                                ib++;
                                mv = (tlena%2 == 0 ? mv : 3-mv);
                                tlenb = b[indb[ee][ib]].first;
                                tlena = a[inda[ee][ia]].first;
                            }
                        }
                        else
                        {
                            if(tlena > tlenb)
                            {
                                mv = (tlenb%2 == 0 ? mv : 3-mv);
                                tlena -= tlenb;
                                if(ib+1 == indb[ee].size())
                                {
                                    dp[j][k] = (tlenb % 2 == 1 ? (mv == 1 ? 1 : 0) : (mv == 1 ? 0 : 1));
                                    break;
                                }
                                else
                                {
                                    ib++;
                                    tlenb = b[indb[ee][ib]].first;
                                }
                            }
                            else
                            {
                                mv = (tlena%2 == 0 ? mv : 3-mv);
                                tlenb -= tlena;
                                if(ia+1 == inda[ee].size())
                                {
                                    dp[j][k] = (tlena % 2 == 1 ? (mv == 1 ? 1 : 0) : (mv == 1 ? 0 : 1));
                                    break;
                                }
                                else
                                {
                                    ia++;
                                    tlena = a[inda[ee][ia]].first;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
   // cout << "!" << endl;
    while(q--)
    {
        int x,y;
        cin >> x >> y;
        int pa = lower_bound(posa.begin(),posa.end(),make_pair(x+1,-1))-posa.begin()-1;
        int pb = lower_bound(posb.begin(),posb.end(),make_pair(y+1,-1))-posb.begin()-1;
        int j = posa[pa].second;
        int k = posb[pb].second;
        int tlena = a[j].first - (x-posa[pa].first);
        int tlenb = b[k].first - (y-posb[pb].first);
        int ee = a[j].second;
        int ia = lower_bound(inda[ee].begin(),inda[ee].end(),j)-inda[ee].begin();
        int ib = lower_bound(indb[ee].begin(),indb[ee].end(),k)-indb[ee].begin();
        int mv = 1;
        //cout << tlena << ' ' << tlenb << "\n";
        while(true)
        {
         //   cout << ia << ' ' << ib << endl;
            if(dpb[inda[ee][ia]][inda[ee][ib]] == 1)
            {
                cout << (mv == 1 ? "Yes" : "No") << "\n";
                break;
            }
            else if(tlena == tlenb)
            {
                if(ib+1 == indb[ee].size() || ia+1 == inda[ee].size())
                {
                    cout << ((tlena % 2 == 1 ? (mv == 1 ? 1 : 0) : (mv == 1 ? 0 : 1)) ? "Yes" : "No") << "\n";
                    break;
                }
                else
                {
                    ia++;
                    ib++;
                    mv = (tlena%2 == 0 ? mv : 3-mv);
                    tlenb = b[indb[ee][ib]].first;
                    tlena = a[inda[ee][ia]].first;
                }
            }
            else
            {
                if(tlena > tlenb)
                {
                   // cout << "!";
                    tlena -= tlenb;
                    if(ib+1 == indb[ee].size())
                    {
                        cout << ((tlenb % 2 == 1 ? (mv == 1 ? 1 : 0) : (mv == 1 ? 0 : 1)) ? "Yes\n" : "No\n");
                        dp[j][k] = (tlenb % 2 == 1 ? (mv == 1 ? 1 : 0) : (mv == 1 ? 0 : 1));
                        break;
                    }
                    else
                    {
                        mv = (tlenb%2 == 0 ? mv : 3-mv);
                        ib++;
                        tlenb = b[indb[ee][ib]].first;
                    }
                }
                else
                {
                    tlenb -= tlena;
                    if(ia+1 == inda[ee].size())
                    {
                        cout << ((tlena % 2 == 1 ? (mv == 1 ? 1 : 0) : (mv == 1 ? 0 : 1)) ? "Yes\n" : "No\n");
                        dp[j][k] = (tlena % 2 == 1 ? (mv == 1 ? 1 : 0) : (mv == 1 ? 0 : 1));
                        break;
                    }
                    else
                    {
                        mv = (tlena%2 == 0 ? mv : 3-mv);
                        ia++;
                        tlena = a[inda[ee][ia]].first;
                    }
                }
            }
        }
    }
    return 0;
}
