#pragma GCC optimize("O0", "unroll-loops")
//#pragma GCC target("avx2", "avx")

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

#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vc vector<char>
#define vvc vector<vc>
#define pii pair<int, int>
#define ll long long

#define f(i, n) for(int i=0;i<n;i++)
#define f1(i, n) for(int i=1;i<n;i++)
#define fr(i, n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(), v.end()

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<>, rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update> ti;

int n, m, k, q;
int nn;
vvi nxta;
vvi nxtb;
map<pii, bool> was;

set<int> ps;
map<int, int> bla;
map<int, int> blb;
map<int, int> ids;
vi vas, vbs;
vi cla;
vi clb;
vi va, vb;
vi pos;

int getbypos(int x)
{
    int p = *(ps.upper_bound(x-1));
    return ids[p];
}

bool get(int x, int y) //win frst
{
    if (was.count({x, y}))
        return was[{x, y}];

    f(i, k)
    {
        int nx = nxta[x+1][i];
        int ny = nxtb[y+1][i];
        if (nx == -1 || ny == -1)
            continue;
        if (x != -1 && cla[x] == cla[nx])
        {
            if (pos[x] % 2 != pos[nx] % 2)
                nx++;
        }
        if (y != -1 && clb[y] == clb[ny])
        {
            if (pos[y] % 2 != pos[ny] % 2)
                ny++;
        }
        if (!get(nx, ny))
            return was[{x, y}] = 1;
    }
    return was[{x, y}] = 0;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int tr1, tr2;
    cin >> tr1 >> n >> tr2 >> m >> k >> q;

    vas = vi(n);
    int c = 0;
    f(i, n)
    {
        int l, v;
        cin >> l >> v;
        v--;
        vas[i] = v;

        if (l == 1)
        {
            ps.insert(c);
            bla[c++] = i;
        }
        else
        {
            ps.insert(c);
            bla[c] = i;
            ps.insert(c+1);
            bla[c+1] = i;
            c += l;
            ps.insert(c-2);
            ps.insert(c-1);
            bla[c-2] = i;
            bla[c-1] = i;
        }
    }

    vbs = vi(m);
    c = 0;
    f(i, m)
    {
        int l, v;
        cin >> l >> v;
        v--;
        vbs[i] = v;

        if (l == 1)
        {
            ps.insert(c);
            blb[c++] = i;
        }
        else
        {
            ps.insert(c);
            blb[c] = i;
            ps.insert(c+1);
            blb[c+1] = i;
            c += l;
            ps.insert(c-2);
            ps.insert(c-1);
            blb[c-2] = i;
            blb[c-1] = i;
        }
    }

    int ti = 0;
    for (int v : ps)
    {
        ids[v] = ti++;
    }

    nn = ids.size();
    pos = vi(nn);
    for (int v : ps)
        pos[ids[v]] = v;

    cla = vi(nn, -1);
    clb = vi(nn, -1);
    for (pii v : bla)
        cla[getbypos(v.first)] = v.second;
    for (pii v : blb)
        clb[getbypos(v.first)] = v.second;
    fr(i, nn-1)
    {
        if (cla[i] == -1)
            cla[i] = cla[i+1];
        if (clb[i] == -1)
            clb[i] = clb[i+1];
    }

    va = vi(nn);
    vb = vi(nn);
    f(i, nn)
        va[i] = vas[cla[i]];
    f(i, nn)
        vb[i] = vbs[clb[i]];

    nxta = vvi(nn+2, vi(k, -1));
    
    fr(i, nn)
    {
        if (i != nn-1)
        {
            f(j, k)
                nxta[i][j] = nxta[i+1][j];
        }
        nxta[i][va[i]] = i;
    }
    nxtb = vvi(nn+2, vi(k, -1));
    fr(i, nn)
    {
        if (i != nn-1)
        {
            f(j, k)
                nxtb[i][j] = nxtb[i+1][j];
        }
        nxtb[i][vb[i]] = i;
    }

    f(i, q)
    {
        int x, y;
        cin >> x >> y;
        int nx = getbypos(x);
        if (pos[nx] % 2 != x % 2)
            nx++;
        int ny = getbypos(y);
        if (pos[ny] % 2 != y % 2)
            ny++;
        int res = get(nx-1, ny-1);
        if (res)
            cout << "Yes\n";
        else
            cout << "No\n";
    }

    return 0;
}