#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using li = __int128;
using db = double;
//using ld = long double;
using pi = pair <int, int>;
using pll = pair <ll, ll>;
#define all(x) x.begin(), x.end()

const ll INFll = 3e14;

mt19937 rnd(time(NULL));

struct V {
    db x;
    db y;
};

V operator+ (const V& a, const V& b) {
    return {a.x + b.x, a.y + b.y};
}
db operator* (const V& a, const V& b) {
    return a.x * b.x + a.y * b.y;
}
db operator^ (const V& a, const V& b) {
    return a.x * b.y - a.y * b.x;
}
V operator* (const V& a, db k) {
    return {a.x * k, a.y * k};
}

ll bin_pow(ll a, ll s, ll mod) {
    ll res = 1;
    while (s) {
        if (s & 1) {
            res *= a;
            res %= mod;
        }
        a = (a * a) % mod;
        s >>= 1;
    }
    return res;
}


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, x;
        cin >> l >> x;
        for (int j = 0; j < l; ++j) a.push_back(x);
    }
    for (int i = 0; i < m; ++i) {
        int l, x;
        cin >> l >> x;
        for (int j = 0; j < l; ++j) b.push_back(x);
    }
    n = N;
    m = M;
    vector <vector <int>> suf_a(n + 1, vector <int> (k + 1, n));
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= k; ++j) suf_a[i][j] = suf_a[i - 1][j];
        suf_a[i][a[n - i]] = n - i;
    }
    vector <vector <int>> suf_b(m + 1, vector <int> (k + 1, m));
    for (int i = 1; i <= m; ++i) {
        for (int j = 0; j <= k; ++j) suf_b[i][j] = suf_b[i - 1][j];
        suf_b[i][b[m - i]] = m - i;
    }

    vector <vector <bool>> dp(n + 1, vector <bool> (m + 1));
    for (int sum = 1; sum <= n + m; ++sum) {
        for (int i = 1; i <= n; ++i) {
            int j = sum - i;
            if (j > m) continue;
            if (j < 0) continue;
            for (int x = 1; x <= k; ++x) {
                if (suf_a[i][x] == n) continue;
                if (suf_b[j][x] == m) continue;
                dp[i][j] = dp[i][j] | (!dp[n - suf_a[i][x] - 1][m - suf_b[j][x] - 1]);
            }
        }
    }

    while (q--) {
        int x, y;
        cin >> x >> y;
        cout << (dp[n - x][m - y] ? "Yes\n" : "No\n");
    }
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) solve();
    return 0;
}
