#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define db long double

using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
    int N, n, M, m, k, q; cin >> N >> n >> M >> m >> k >> q;

    vector<int> a, b;
    for (int i = 0; i < n; ++i) {
        int l, v; cin >> l >> v;

        while (l--) a.push_back(v);
    }

    for (int i = 0; i < m; ++i) {
        int l, v; cin >> l >> v;

        while (l--) b.push_back(v);
    }

    vector<vector<bool>> dp(N + 1, vector<bool>(M + 1, false));

    vector<vector<int>> pos1(k + 1), pos2(k + 1);
    for (int i = 0; i < N; ++i) {
        pos1[a[i]].push_back(i);
    }

    for (int i = 0; i < M; ++i) {
        pos2[b[i]].push_back(i);
    }

    for (int i = N; i >= 0; --i) {
        for (int j = M; j >= 0; --j) {
            for (int val = 1; val <= k; ++val) {
                int p1 = lower_bound(pos1[val].begin(), pos1[val].end(), i) - pos1[val].begin();
                int p2 = lower_bound(pos2[val].begin(), pos2[val].end(), j) - pos2[val].begin();

                if (p1 < pos1[val].size() && p2 < pos2[val].size() && !dp[pos1[val][p1] + 1][pos2[val][p2] + 1]) {
                    dp[i][j] = true;
                }
            }
        }
    }

    for (int i = 0; i < q; ++i) {
        int x, y; cin >> x >> y;

        if (dp[x][y]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int tt = 1;
    while (tt--) {
        solve();
        cout << "\n";
    }
}