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

#define pii pair <int, int>
#define fi first
#define se second
#define pb push_back
#define int int64_t
#define pw(x) (int64_t(1)<<x)

using namespace std;
using namespace __gnu_pbds;

typedef tree <int, null_type, less_equal <int>, rb_tree_tag, tree_order_statistics_node_update> oset;

mt19937 gen(time(0));

const int INF = 1e18;

int32_t main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // LOCAL
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector <int> a;
    vector <int> la(n), va(n);
    for (int i = 0; i < n; ++i) {
        cin >> la[i] >> va[i];
        for (int j = 0; j < la[i]; ++j) {
            a.pb(va[i]);
        }
    }
    vector <int> b;
    vector <int> lb(m), vb(m);
    for (int i = 0; i < m; ++i) {
        cin >> lb[i] >> vb[i];
        for (int j = 0; j < lb[i]; ++j) {
            b.pb(vb[i]);
        }
    }
    set <int> posA[k + 1];
    set <int> posB[k + 1];
    for (int i = 0; i < N; ++i) {
        posA[a[i]].insert(i);
    }
    for (int i = 0; i < M; ++i) {
        posB[b[i]].insert(i);
    }
    auto getA = [&] (int i, int x) {
        auto it = posA[x].lower_bound(i);
        if (it == posA[x].end()) return N;
        else return *it;
    };
    auto getB = [&] (int i, int x) {
        auto it = posB[x].lower_bound(i);
        if (it == posB[x].end()) return M;
        else return *it;
    };
    set <int> have;
    for (int i : a) have.insert(i);
    for (int i : b) have.insert(i);
    vector <vector <int>> dp(N + 1, vector <int> (M + 1));
    for (int i = N - 1; i >= 0; --i) {
        for (int j = M - 1; j >= 0; --j) {
            for (int x : have) {
                int i1 = getA(i, x);
                int j1 = getB(j, x);
                if (i1 == N || j1 == M) {
                    dp[i][j] = 0;
                    continue;
                }
                if (i1 == N - 1 || j1 == M - 1) {
                    dp[i][j] = 1;
                    continue;
                }
                if (!dp[i1 + 1][j1 + 1]) {
                    dp[i][j] = 1;
                    break;
                }
            }
        }
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (dp[x][y]) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }
}
