#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int>a(N);
    vector<int>b(M);
    int ind = 0;
    int l, v;
    for(int i = 0; i < n; i++)
    {
        cin >> l >> v;
        v--;
        while(l)
        {
            l--;
            a[ind] = v;
            ind++;
        }
    }
    ind = 0;
    for(int i = 0; i < m; i++)
    {
        cin >> l >> v;
        v--;
        while(l)
        {
            l--;
            b[ind] = v;
            ind++;
        }
    }
    vector<vector<int>>ar(k, vector<int>(N));
    for(int i = 0; i < k; i++)
    {        
        l = -1;
        for(int j = N - 1; j > -1; j--)
        {
            ar[i][j] = l;
            if(a[j] == i)
            {
                l = j;
            }
        }
    }
    vector<vector<int>>br(k, vector<int>(M));
    for(int i = 0; i < k; i++)
    {        
        l = -1;
        for(int j = M - 1; j > -1; j--)
        {
            br[i][j] = l;
            if(b[j] == i)
            {
                l = j;
            }
        }
    }
    vector<vector<int>>gran(N, vector<int>(M));
    vector<char>game(k + 1);
    for(int i = N - 1; i > -1; i--)
    {
        for(int j = M - 1; j > -1; j--)
        {
            if(a[i] != b[j])
            {
                continue;
            }
            game.assign(k + 1, 0);
            for(int g = 0; g < k; g++)
            {
                if(br[g][j] != -1 && ar[g][i] != -1)
                {
                    game[gran[ar[g][i]][br[g][j]]] = 1;
                }
            }
            for(int g = 0; g <= k; g++)
            {
                if(not(game[g]))
                {
                    gran[i][j] = g;
                    break;
                }
            }
        }
    }
    int x, y;
    while(q)
    {
        cin >> x >> y;
        q--;
        if(gran[x][y] != 0)
        {
            cout << "No" << endl;
        }
        else
        {
            cout << "Yes" << endl;
        }
    }
}