//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;

#pragma GCC optimize("O3,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,bmi,bmi2,lzcnt,popcnt,tune=native")

/*
struct Update {
    int add = 0;
    Update() : add(0) {}
    Update(int add) : add(add) {}
    Update apply(Update other) {
        return add + other.add;
    }
};

struct Node {
    int summ = 0, l = 0, r = 0;
    Node() : summ(0), l(0), r(0) {}
    Node(int x) : summ(x) {}
    Node(int x, int l, int r) : summ(x), l(l), r(r) {}
    Node merge(Node other) {
        return Node(summ + other.summ, l, other.r);
    }
    Node apply(Update other) {
        return Node(summ + other.add * (r - l), l, r);
    }
};

struct seg_tree {
    int n;
    vector<int> a;
    vector<Node> tree;
    vector<Update> updates;

    seg_tree(vector<int> a2) {
        n = a2.size();
        a = a2;
        tree.resize(4 * n);
        updates.resize(4 * n);
        build(0, 0, n);
    }

    void push(int v) {
        if (updates[v].add != 0) {
            updates[2 * v + 1] = updates[2 * v + 1].apply(updates[v]);
            updates[2 * v + 2] = updates[2 * v + 2].apply(updates[v]);
            tree[2 * v + 1] = tree[2 * v + 1].apply(updates[v]);
            tree[2 * v + 2] = tree[2 * v + 2].apply(updates[v]);
            updates[v] = 0;
        }
    }

    void build(int v, int l, int r) {
        tree[v].l = l;
        tree[v].r = r;
        if (l == r - 1) {
            tree[v].summ = a[l];
            return;
        }
        int mid = (l + r) / 2;
        build(2 * v + 1, l, mid);
        build(2 * v + 2, mid, r);
        tree[v] = tree[2 * v + 1].merge(tree[2 * v + 2]);
    }

    Node get(int v, int l, int r, int ql, int qr) {
        if (ql <= l && r <= qr) {
            return tree[v];
        }
        if (qr <= l || r <= ql) {
            return Node();
        }
        push(v);
        int mid = (l + r) / 2;
        return get(2 * v + 1, l, mid, ql, qr).merge(get(2 * v + 2, mid, r, ql, qr));
    }


    Node get_q(int l, int r) {
        return get(0, 0, n, l, r);
    }


    void update(int v, int l, int r, int ql, int qr, Update add) {
        if (ql <= l && r <= qr) {
            tree[v] = tree[v].apply(add);
            updates[v] = updates[v].apply(add);
            return;
        }
        if (qr <= l || r <= ql) {
            return;
        }
        push(v);
        int mid = (l + r) / 2;
        update(2 * v + 1, l, mid, ql, qr, add);
        update(2 * v + 2, mid, r, ql, qr, add);
        tree[v] = tree[2 * v + 1].merge(tree[2 * v + 2]);
    }

    void update_q(int l, int r, int add) {
        update(0, 0, n, l, r, add);
    }
};

struct pt {
    int x, y;
    pt() : x(0), y(0) {}
    pt(int x, int y) : x(x), y(y) {}
    pt(pt s, pt t) : x(t.x - s.x), y(t.y - s.y) {}

    int operator*(pt other) {
        return x * other.y + y * other.x;
    }
    int operator%(pt other) {
        return x * other.y - y * other.x;
    }

    pt operator*(int k) {
        return pt(x * k, y * k);
    }

    pt operator+(pt other) {
        return pt(x + other.x, y + other.y);
    }

    pt operator-(pt other) {
        return pt(x - other.x, y - other.y);
    }
};

struct line {
    int a, b, c;
    line() : a(0), b(0), c(0) {}
    line(pt s, pt t) {
        a = t.y - s.y;
        b = s.x - t.x;
        c = -(t.y * s.x - t.x * s.y);
        //(t.y - s.y) * t.x + (s.x - t.x) * t.y = -s.y * t.x + s.x * t.y
        //(t.y - s.y) * s.x + (s.x - t.x) * s.y = t.y * s.x - t.x * s.y
    }

    bool is_on_line(pt other) {
        return other.x * a + other.y * b + c == 0;
    }
};*/

vector<vector<int>> g_new;
int best = 0;
vector<int> sz;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int N, n, M, m, k, q, now = 0;
    cin >> N >> n >> M >> m >> k >> q;
    vector<long long> all_a, all_b;
    vector<pair<long long, long long>> a(n);
    vector<long long> next_not_same_a;
    now = 0;
    for (long long i = 0; i < n; i++) {
        cin >> a[i].first >> a[i].second;
        now += a[i].first;
        for (long long j = 0; j < a[i].first; j++) {
            all_a.push_back(a[i].second);
            next_not_same_a.push_back(now);
        }
    }
    vector<pair<long long, long long>> b(m);
    vector<long long> next_not_same_b;
    now = 0;
    for (long long i = 0; i < m; i++) {
        cin >> b[i].first >> b[i].second;
        now += b[i].first;
        for (long long j = 0; j < b[i].first; j++) {
            all_b.push_back(b[i].second);
            next_not_same_b.push_back(now);
        }
    }
    vector<vector<bool>> dp(all_a.size() + 1, vector<bool> (all_b.size() + 1));
    for (long long i = -1 + all_a.size(); i >= 0; i--) {
        for (long long j = -1 + all_b.size(); j >= 0; j--) {
            dp[i][j] = dp[i][j] || dp[next_not_same_a[i]][j];
            dp[i][j] = dp[i][j] || dp[i][next_not_same_b[j]];
            if (all_a[i] == all_b[j]) {
                dp[i][j] = dp[i][j] || !dp[i + 1][j + 1];
            }
        }
    }
    while (q--) {
        long long x, y;
        cin >> x >> y;
        if (dp[x][y]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

