#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define size(t) (int)t.size()
#define pb push_back
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()

using namespace std;

const int T = 5005;

int w[T][T];
vector <int> v[2][T];

int lb(int x, int i, int t) {
    if (lower_bound(all(v[t][x]), i) == v[t][x].end())
        return -1;
    return *lower_bound(all(v[t][x]), i);
}

void solve() {
    int N, n, M, m, k, q, i, j, x, y;
    cin >> N >> n >> M >> m >> k >> q;
    vector <int> a, b;
    int d1, d2, cnt1 = 0, cnt2 = 0;
    for (i = 0; i < n; i++) {
        cin >> j >> x;
        if (i == 0) {
            d1 = j;
        }
        else {
            if (x == 1)
                cnt1 += j;
            while (j--)
                a.pb(x);
        }
    }
    for (i = 0; i < m; i++) {
        cin >> j >> x;
        if (i == 0) {
            d2 = j;
        }
        else {
            if (x == 1)
                cnt2 += j;
            while (j--)
                b.pb(x);
        }
    }
    vector <int> aa(min(d1, cnt2), 1);
    for (auto x:a)
        aa.pb(x);
    swap(a, aa);
    vector <int> bb(min(d2, cnt1), 1);
    for (auto x:b)
        bb.pb(x);
    swap(b, bb);
    N = size(a); M = size(b);
    for (i = 0; i < N; i++) {
        v[0][a[i]].pb(i);
    }
    for (i = 0; i < M; i++) {
        v[1][b[i]].pb(i);
    }
    w[1][1] = (a[N - 1] == b[M - 1]);
    for (i = 2; i <= max(N, M); i++) {
        if (i <= N) {
            for (j = 1; j <= min(i, M); j++) {
                for (x = 1; x <= k; x++) {
                    int t1 = lb(x, N - i, 0), t2 = lb(x, M - j, 1);
                    if (t1 == -1 || t2 == -1)
                        continue;
                    if (!w[N - t1 - 1][M - t2 - 1]) {
                        w[i][j] = 1;
                        break;
                    }
                }
            }
        }
        if (i <= M) {
            for (j = 1; j <= min(i, N); j++) {
                for (x = 1; x <= k; x++) {
                    int t1 = lb(x, N - j, 0), t2 = lb(x, M - i, 1);
                    if (t1 == -1 || t2 == -1)
                        continue;
                    if (!w[N - t1 - 1][M - t2 - 1]) {
                        w[j][i] = 1;
                        break;
                    }
                }
            }
        }
    }
    while (q--) {
        cin >> x >> y;
        i = N + max(0, d1 - cnt2) - x;
        j = M + max(0, d2 - cnt1) - y;
        if (w[min(i, N)][min(j, M)]) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // LOCAL
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}

