#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
using namespace std;

char cache[5001][5001];
int cache2[2][5001][1801];
vector<int> vals;

vector<pair<int, int>> A[2][1801];
int sz[2] = {0, 0};
vector<pair<int, int>> vals_a;


int find_next_pos(int i, int pos, int want) {
    if (A[i][want].empty()) return -1;
    if (cache2[i][pos][want] != -2) return cache2[i][pos][want];
    auto it = lower_bound(A[i][want].begin(), A[i][want].end(), pair<int, int>{pos + 1, -1});
    if (it != A[i][want].begin() && prev(it)->second > pos) --it;
    if (it != A[i][want].end() && it->second <= pos) ++it;
    if (it == A[i][want].end()) return cache2[i][pos][want] = -1;
    return cache2[i][pos][want] = max(pos + 1, it->first);
}

bool solve(int x, int y) {
    if (cache[x][y] != -1) {
        return cache[x][y];
    }
    bool good = false;
    for (int v: vals) {
        int xnew = find_next_pos(0, x, v);
        if (xnew == -1) continue;
        int ynew = find_next_pos(1, y, v);
        if (ynew == -1) continue;
        if (!solve(xnew, ynew)) {
            good = true;
            break;
        }
    }
    return cache[x][y] = good;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);


    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cache[i][j] = -1;
        }
    }

    set<int> vals1, vals2;
    for (int i = 0; i < n; i++) {
        int l, v;
        cin >> l >> v;
        A[0][v].emplace_back(sz[0], sz[0] + l - 1);
        vals_a.emplace_back(sz[0], v);
        sz[0] += l;
        vals1.insert(v);
    }

    for (int i = 0; i < m; i++) {
        int l, v;
        cin >> l >> v;
        A[1][v].emplace_back(sz[1], sz[1] + l - 1);
        sz[1] += l;
        vals2.insert(v);
    }
    for (int x: vals1) {
        if (vals2.contains(x)) {
            vals.push_back(x);
        }
    }

    for (int x : vals) {
        for (int i = 0; i < N; i++) {
            cache2[0][i][x] = -2;
        }
        for (int i = 0; i < M; i++) {
            cache2[1][i][x] = -2;
        }
    }

    while (q--) {
        int x, y;
        cin >> x >> y;
        if (!solve(x, y)) {
            cout << "Yes\n";
            continue;
        }
        int skip = prev(lower_bound(vals_a.begin(), vals_a.end(), pair<int, int>{x + 1, -1}))->second;
        bool good = false;
        for (int v: vals) {
            if (v == skip) continue;
            int xnew = find_next_pos(0, x, v);
            int ynew = find_next_pos(1, y, v);
            if (xnew != -1 && ynew != -1 && !solve(xnew, ynew)) {
                good = true;
                break;
            }
        }
        cout << (good ? "Yes" : "No") << "\n";
    }
    return 0;
}