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

#define all(x) x.begin(), x.end()
#define ff first
#define ss second

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using pii = pair<int, int>;

constexpr ll MAXSZ = 2e6;

ll a[MAXSZ], b[MAXSZ];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // freopen("inputa2.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    ll N, n, M, m, mxval, q;
    cin >> N >> n >> M >> m >> mxval >> q;
    ll aptr = 1, bptr = 1;
    for (ll i = 0; i < n; ++i) {
        ll l, v;
        cin >> l >> v;
        for (ll j = 0; j < l; ++j) {
            a[aptr++] = v;
        }
    }
    for (ll i = 0; i < m; ++i) {
        ll l, v;
        cin >> l >> v;
        for (ll j = 0; j < l; ++j) {
            b[bptr++] = v;
        }
    }
    n = N;
    m = M;

    ll nxt[2000];
    nxt[a[n]] = n;
    vector<vector<bool>> dp(n + 1, vector<bool>(m + 1));  // 0 - win, 1 - lose
    for (ll i = n - 1; i >= 0; --i) {
        unordered_set<ll> falsecnt;
        for (ll j = m - 1; j >= 0; --j) {
            falsecnt.erase(b[j + 1]);
            if (nxt[b[j + 1]] != 0 && !dp[nxt[b[j + 1]]][j + 1]) {
                falsecnt.insert(b[j + 1]);
            }
            dp[i][j] = falsecnt.size() > 0;
        }
        nxt[a[i]] = i;
    }
    for (ll i = 0; i < q; ++i) {
        ll x, y;
        cin >> x >> y;
        cout << (dp[x][y] ? "Yes" : "No") << '\n';
    }
}
