#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#ifndef DEBUG
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
#endif

using namespace __gnu_pbds;

template<typename T>
using oset = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = int;
using pll = std::pair<ll, ll>;
using ld = long double;
using i128 = __int128;

#define lv(v) v + 1
#define rv(v) v + 2 * (m - l)

std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());

void solve() {
    ll N, n, M, m, k, q;
    std::cin >> N >> n >> M >> m >> k >> q;
    std::vector<std::vector<ll>> dp(N + 1, std::vector<ll>(M + 1, 0));
    std::vector<ll> a, b;
    std::vector<ll> d;
    for (int i = 0; i < n; ++i) {
        ll l, x;
        std::cin >> l >> x;
        while (l--) {
            a.push_back(x);
        }
        d.push_back(x);
    }
    for (int i = 0; i < m; ++i) {
        ll l, x;
        std::cin >> l >> x;
        while (l--) {
            b.push_back(x);
        }
        d.push_back(x);
    }
    std::sort(d.begin(), d.end());
    d.erase(std::unique(d.begin(), d.end()), d.end());
    std::vector<std::vector<ll>> rga(N, std::vector<ll>(d.size(), -1));
    std::vector<std::vector<ll>> rgb(M, std::vector<ll>(d.size(), -1));
    for (int i = N - 1; i >= 0; --i) {
        for (int j = 0; j < d.size(); ++j) {
            if (a[i] == d[j]) {
                rga[i][j] = i + 1;
            } else if (i != N - 1) {
                rga[i][j] = rga[i + 1][j];
            }
        }
    }
    for (int i = M - 1; i >= 0; --i) {
        for (int j = 0; j < d.size(); ++j) {
            if (b[i] == d[j]) {
                rgb[i][j] = i + 1;
            } else if (i != M - 1) {
                rgb[i][j] = rgb[i + 1][j];
            }
        }
    }
    for (int i = N - 1; i >= 0; --i) {
        for (int j = M - 1; j >= 0; --j) {
            std::vector<ll> c;
            bool flg = false;
            for (int u = 0; u < d.size(); ++u) {
                if (rga[i][u] != -1 && rgb[j][u] != -1) {
                    flg |= !(dp[rga[i][u]][rgb[j][u]]);
                    if (flg){
                        dp[i][j] = flg;
                        break;
                    }
                }
            }
        }
    }
    while (q--) {
        ll x, y;
        std::cin >> x >> y;
        if (dp[x][y]) {
            std::cout << "Yes\n";
        } else {
            std::cout << "No\n";
        }
    }
}

int main() {
#ifdef DEBUG
    std::freopen("/home/olymp/CLionProjects/untitled/input.txt", "r", stdin);
#endif
    std::cin.tie(0)->std::ios::sync_with_stdio(0);
    int tt = 1;
//    std::cin >> tt;
    while (tt--) {
        solve();
    }
}
