#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db double
#define str string
#define vc vector
#define its(a) (a).begin(), (a).end()
#define itsr(a) (a).rbegin(), (a).rend()
#define tstr(a) to_string((a))
#define INF ((ll)1e18)

void solve() {
    ll N, n, M, m, k, q; cin >> N >> n >> M >> m >> k >> q;
    vc<ll> a = { 0 };
    vc<ll> b = { 0 };
    for (int i = 0;i < n;++i) {
        ll c, l; cin >> l >> c;
        for (int j = 0;j < l;++j) a.push_back(c);
    }
    for (int i = 0;i < m;++i) {
        ll c, l; cin >> l >> c;
        for (int j = 0;j < l;++j) b.push_back(c);
    }
    vc<ll> nxt(k + 1, -1);
    ++N, ++M;
    vc<vc<ll>> jmp1(N, vc<ll>(k + 1));
    vc<vc<ll>> jmp2(N, vc<ll>(k + 1));
    for (int i = N - 1;i >= 0;--i) {
        for (int j = 1;j <= k;++j) {
            jmp1[i][j] = nxt[j];
        }
        nxt[a[i]] = i;
    }
    nxt.assign(k + 1, -1);
    for (int i = M - 1;i >= 0;--i) {
        for (int j = 1;j <= k;++j) {
            jmp2[i][j] = nxt[j];
        }
        nxt[b[i]] = i;
    }
    vc<vc<ll>> dp(N, vc<ll>(M));
    for (int j = 0;j < M;++j) dp[N - 1][j] = 0;
    for (int i = 0;i < N-1;++i) dp[i][M-1] = 1;

    for (int i = N - 2;i >= 0;--i) {
        for (int j = M - 2;j >= 0;--j) {
            bool f = 0;
            for (int c = 1;c <= k;++c) {
                ll in = jmp1[i][c];
                ll jn = jmp2[j][c];
                if (in < N and jn < M and in >= 0 and jn >= 0) {
                    if (dp[in][jn] == 0) f = 1;
                }
                
            }
            dp[i][j] = f;
        }
    }
    while (q--) {
        ll x, y; cin >> x >> y;
        
        if (dp[x][y]) cout << "Yes\n";
        else cout << "No\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll _t = 1;
    //cin >> _t;
    while (_t--)
        solve();
}
