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


using ll = long long;
const ll inf = 1e18;


int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    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;
        --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 = a.size(), m = b.size();
    vector<vector<bool>> dp(n + 1,vector<bool>(m + 1));
    vector<int> nxa(k, n + 1);
    for (int i = n; i >= 0; --i) {
        if (i < n) nxa[a[i]] = i + 1;
        vector<int> nxb(k, m + 1);
        int cnt = k;
        for (int j = m; j >= 0; --j) {
            if (i == n || j == m) {
                dp[i][j] = false;
                continue;
            }
            if (j < m) {
                cnt -= nxa[b[j]] > n || nxb[b[j]] > m || dp[nxa[b[j]]][nxb[b[j]]];
                nxb[b[j]] = j + 1;
                cnt += nxa[b[j]] > n || nxb[b[j]] > m || dp[nxa[b[j]]][nxb[b[j]]];
            }
            dp[i][j] = cnt < k;
        }
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (dp[x][y]) cout << "Yes\n";
        else cout << "No\n";
    }
}