#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
//#define int ll
#define pb push_back
#define pii pair<int, int>
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 5010;

int N, n, M, m, k, q, a[MAXN], b[MAXN], dp[MAXN][MAXN], la[MAXN], lb[MAXN];

void solve() {
    cin >> N >> n >> M >> m >> k >> q;
    int tmr = 1;
    for(int i = 0; i < n; ++i) {
        int len, x; cin >> len >> x;
        while(len--) a[tmr++] = x;
    }
    tmr = 1;
    for(int i = 0; i < m; ++i) {
        int len, x; cin >> len >> x;
        while(len--) b[tmr++] = x;
    }
    for(int i = N; i >= 1; --i) {
        fill(lb, lb + k + 1, 0);
        int cnt_bad = 0;
        if(la[a[i]] != 0 && lb[a[i]] != 0) {
            if(!dp[la[a[i]] + 1][lb[a[i]] + 1]) --cnt_bad;
        }
        la[a[i]] = i;
        if(la[a[i]] != 0 && lb[a[i]] != 0) {
            if(!dp[la[a[i]] + 1][lb[a[i]] + 1]) ++cnt_bad;
        }
        for(int j = M; j >= 1; --j) {
            if(la[b[j]] != 0 && lb[b[j]] != 0) {
                if(!dp[la[b[j]] + 1][lb[b[j]] + 1]) --cnt_bad;
            }
            lb[b[j]] = j;
            if(la[b[j]] != 0 && lb[b[j]] != 0) {
                if(!dp[la[b[j]] + 1][lb[b[j]] + 1]) ++cnt_bad;
            }
            //cout << i << ' ' << j << ": " << cnt_bad << '\n';
            if(cnt_bad > 0) dp[i][j] = true;
        }
    }
    while(q--) {
        int x, y; cin >> x >> y;
        ++x, ++y;
        if(dp[x][y]) cout << "Yes\n";
        else cout << "No\n";
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    auto start = clock();
#endif
    int ttt = 1;
    //cin >> ttt;
    while(ttt--) {
        solve();
    }
#ifdef LOCAL
    auto end = clock();
    cerr << "TIME: " << (end - start) << "ms" << '\n';
#endif
}