#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, N, M, m, k, q;
    cin >> n >> N >> m >> M >> k >> q;
    vector<int> ans1(n);
    vector<int> ans2(m);
    int cnt = 0;
    for (int h = 0; h < N; h++) {
        int l, v;
        cin >> l >> v;
        v--;
        for (int i = cnt; i < cnt + l; i++) {
            ans1[i] = v;
        }
        cnt += l;
    }
    cnt = 0;
    for (int h = 0; h < M; h++) {
        int l, v;
        cin >> l >> v;
        v--;
        for (int i = cnt; i < cnt + l; i++) {
            ans2[i] = v;
        }
        cnt += l;
    }
    vector<vector<bool>> dp(n + 1, vector<bool> (m + 1, true));
    vector<vector<bool>> dp2(n + 1, vector<bool> (m + 1, true));
    for (int i = 0; i <= m; i++) {
        dp[n][i] = false;
        dp2[n][i] = false;
    }
    for (int i = 0; i <= n; i++) {
        dp2[i][m] = false;
        dp[i][m] = false;
    }
    vector<pair<int, int>> v1(k, {-1, -1});
    vector<pair<int, int>> v2(k, {-1, -1});
    int w = 0;
    for (int sum = n + m - 2; sum > -1; sum--) {
        for (int y = min(sum, m - 1); y > max((int)-1, sum - n); y--) {
            int i = sum - y;
            w++;
            for (int j = n - 1; j >= i; j--) {
                v1[ans1[j]].first = w;
                v1[ans1[j]].second = j;
            }
            for (int j = m - 1; j >= y; j--) {
                v2[ans2[j]].first = w;
                v2[ans2[j]].second = j;
            }
            dp[i][y] = false;
            dp2[i][y] = false;
            for (int j = i; j < n; j++) {
                if (v1[ans1[j]].second == j) {
                    pair<int, int> r = v2[ans1[j]];
                    if (r.first == w) {
                        if (!dp2[j + 1][r.second + 1]) {
                            dp[i][y] = true;
                        }
                    }
                }
            }
            for (int j = y; j < m; j++) {
                if (v2[ans2[j]].second == j) {
                    pair<int, int> r = v1[ans2[j]];
                    if (r.first == w) {
                        if (!dp[r.second + 1][j + 1]) {
                            dp2[i][y] = true;
                        }
                    }
                }
            }
        }
    }
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y;
        if (dp[x][y]) {
            cout << "Yes" << "\n";
        } else {
            cout << "No" << "\n";
        }
    }
}
