#pragma GCC optimize("O3", "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, n, M, m, k, q;
vi a, b;
vi ac, bc;
vvi nxta;
vvi nxtb;
map<pii, bool> was;

int nexta(int s, int v)
{
    for (int i = s+1; i < a.size(); i++)
        if (a[i] == v)
            return i;
    return -1;
}
int nextb(int s, int v)
{
    for (int i = s+1; i < b.size(); i++)
        if (b[i] == v)
            return i;
    return -1;
}

bool get(int x, int y) //win frst
{
    if (x >= 0 && y >= 0)
    {
        for (int d = (2<<25); d >= 2; d /= 2)
        {
            if (x + d >= N)
                continue;
            if (ac[x] == ac[x+d])
            {
                x += d;
            }
        }
        for (int d = (2<<25); d >= 2; d /= 2)
        {
            if (y + d >= M)
                continue;
            if (bc[y] == bc[y+d])
            {
                y += d;
            }
        }
    }

    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 (!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);

    cin >> N >> n >> M >> m >> k >> q;
    a = vi(N);
    ac = vi(N+2, -1);
    b = vi(M);
    bc = vi(M+2, -1);

    int c = 0;
    f(i, n)
    {
        int l, v;
        cin >> l >> v;
        v--;
        f(j, l)
        {
            ac[c] = i;
            a[c++] = v;
        }
    }
    c = 0;
    f(i, m)
    {
        int l, v;
        cin >> l >> v;
        v--;
        f(j, l)
        {
            bc[c] = i;
            b[c++] = v;
        }
    }

    nxta = vvi(N+1, vi(k, -1));
    fr(i, N)
    {
        if (i != N-1)
        {
            f(j, k)
                nxta[i][j] = nxta[i+1][j];
        }
        nxta[i][a[i]] = i;
    }
    nxtb = vvi(M+1, vi(k, -1));
    fr(i, M)
    {
        if (i != M-1)
        {
            f(j, k)
                nxtb[i][j] = nxtb[i+1][j];
        }
        nxtb[i][b[i]] = i;
    }

    f(i, q)
    {
        int x, y;
        cin >> x >> y;
        int res = get(x-1, y-1);
        if (res)
            cout << "Yes\n";
        else
            cout << "No\n";
    }

    return 0;
}