// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

mt19937 rnd(69); // chrono::steady_clock::now().time_since_epoch().count()
#define all(x) x.begin(), x.end()
#define int long long
#define ull unsigned long long
#define ld long double
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")

const long long INF = 1e15 + 69;

signed main()
{
    ios_base::sync_with_stdio(false);
    int N, n, M, m, k, q, cur_ind_a, cur_ind_b, l, v, x, y;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a(N);
    vector<int> b(M);
    cur_ind_a = -1;
    cur_ind_b = -1;
    for (int i = 0; i < n; i++) {
        cin >> l >> v;
        v--;
        for (int j = 0; j < l; j++) {
            cur_ind_a++;
            a[cur_ind_a] = v;
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> l >> v;
        v--;
        for (int j = 0; j < l; j++) {
            cur_ind_b++;
            b[cur_ind_b] = v;
        }
    }
    n = N;
    m = M;
    vector<vector<bool>> dp(n, vector<bool>(m, false));
    vector<int> cnt_ans(k, 0);
    int all_cnt = 0;
    vector<bool> is_event(m, false);
    vector<int> prev_ind_a(k, -1);
    for (int i = n - 1; i >= 0; i--) {
        all_cnt = 0;
        cnt_ans.assign(k, 0);
        prev_ind_a[a[i]] = i;
        vector<int> prev_ind_b(k, -1);
        for (int j = m - 1; j >= 0; j--) {
            prev_ind_b[b[j]] = j;
            for (int x = 0; x < k; x++) {
                if (prev_ind_a[x] != -1 && prev_ind_b[x] != -1) {
                    if (prev_ind_a[x] == n - 1 || prev_ind_b[x] == m - 1 || !dp[prev_ind_a[x] + 1][prev_ind_b[x] + 1]) {
                        dp[i][j] = true;
                        break;
                    }
                }
            }
        }
    }
    for (int i = 0; i < q; i++) {
        cin >> x >> y;
        if (dp[x][y]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
    return 0;
}
