#ifdef LOCAL
#define _GLIBCXX_DEBUG
#else
#pragma GCC optimize("O3")
#endif

#include <bits/stdc++.h>
using namespace std;

#define int int64_t
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())
using ld = long double;
using ll = int64_t;
using ull = uint64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;

void solve();

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    while (t--) {
        solve();
    }
    return 0;
}
int N, n, M, m, k, q;
vector<pii> a, b;
vector<int> A, B;
vector<vector<int>> pos_A, pos_B;
vector<vector<int>> closest_A, closest_B;

// int closest_b(int i, int x) {
//     return *lower_bound(all(pos_B[x]), i);
// };

#define MAX_MEMO 5052
int memo[MAX_MEMO][MAX_MEMO];
bool dp(int la, int lb) {
    if (la == N) return false;
    if (lb == M) return false;
    if (memo[la][lb] != -1) return memo[la][lb];
    // return !dp(closest_A[la][A[la]], closest_B[lb][B[lb]]);
    for (int x = 1; x <= k; x++) {
        int i = closest_A[la][x];
        int j = closest_B[lb][x];
        if (i != N && j != M && dp(i + 1, j + 1) == false) {
            return memo[la][lb] = true;
        }
    }
    return memo[la][lb] = false;
}

void solve() {
    for (int i = 0; i < MAX_MEMO; i++) {
        fill(memo[i], memo[i] + MAX_MEMO, -1);
    }
    cin >> N >> n >> M >> m >> k >> q;
    for (int i = 0; i < n; i++) {
        int l, v;
        cin >> l >> v;
        a.push_back({l, v});
        while (l--) {
            A.push_back(v);
        }
    }
    for (int i = 0; i < m; i++) {
        int l, v;
        cin >> l >> v;
        b.push_back({l, v});
        while (l--) {
            B.push_back(v);
        }
    }
    vector<int> now_closest_A(k + 1, N);
    vector<int> now_closest_B(k + 1, N);
    closest_A.resize(N, vector<int>(k + 1));
    closest_B.resize(M, vector<int>(k + 1));
    for (int i = N - 1; i >= 0; i--) {
        now_closest_A[A[i]] = i;
        closest_A[i] = now_closest_A;
    }
    for (int i = M; i >= 0; i--) {
        now_closest_B[B[i]] = i;
        closest_B[i] = now_closest_B;
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (dp(x, y)) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }
}