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

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("O3,unroll-loops")
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;
using str = string;
using ordered_set = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
const ll INF = 1e18, MOD = 1e9 + 7;
#define int long long

void solve();

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    //cin >> _;
    while (_--) {
        solve();
        cout << "\n";
    }
}

void solve() {
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a;
    vector<int> b;
    for (int i = 0; i < n; ++i) {
        int l, v;
        cin >> l >> v;
        v--;
        while (l--) {
            a.push_back(v);
        }
    }
    for (int i = 0; i < m; ++i) {
        int l, v;
        cin >> l >> v;
        v--;
        while (l--) {
            b.push_back(v);
        }
    }
    n = N;
    m = M;
    vector<vector<int>> ba(n + 1, vector<int>(k));
    for (int i = 0; i < k; ++i) {
        ba[n][i] = n;
    }
    for (int i = n - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j) {
            ba[i][j] = ba[i + 1][j];
        }
        ba[i][a[i]] = i;
    }
    vector<vector<int>> bb(m + 1, vector<int>(k));
    for (int i = 0; i < k; ++i) {
        bb[m][i] = m;
    }
    for (int i = m - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j) {
            bb[i][j] = bb[i + 1][j];
        }
        bb[i][b[i]] = i;
    }
    set<int> u;
    vector<int> d;
    for (int i = n - 1; i >= 0; --i) {
        if (u.find(a[i]) == u.end()) {
            d.push_back(a[i]);
            u.insert(a[i]);
        }
    }
    vector<vector<bool>> dp(n + 1, vector<bool>(m + 1));
    for (int i = n - 1; i >= 0; --i) {
        for (int j = m - 1; j >= 0; --j) {
            int o = 0;
            for (auto l: d) {
                if (o >= 100) {
                    break;
                }
                if (ba[i][l] < n && bb[j][l] < m) {
                    if (!dp[ba[i][l] + 1][bb[j][l] + 1]) {
                        dp[i][j] = true;
                        break;
                    }
                    o++;
                } else if (ba[i][l] == n) {
                    break;
                }
            }
        }
    }
    for (int i = 0; i < q; ++i) {
        int x, y;
        cin >> x >> y;
        if (dp[x][y]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}