#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define allv(x) (x).begin(), (x).end()
#define allv_rev(x) (x).rbegin(), (x).rend()
#define lolset(x) memset(x, 0, sizeof (x))
#define lolfill(x, v) fill(x, x + sizeof(x) / sizeof(*x), v)
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
template<typename T, typename T2>
bool smin(T &a, T2 const& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename T2>
bool smax(T &a, T2 const& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

template<typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &i : v)
        is >> i;
    return is;
}




#ifdef DEBUG
const ll MAXK = 10, MAXN = 10, INF = 1e6;
#else
const ll MAXK = 1610, MAXN = 5010, INF = 1e9 + 1e6 * 228;
#define cerr if (0) cerr
#endif


bool dp[MAXN][MAXN];
int nxta[MAXN][MAXK];
int nxtb[MAXN][MAXK];

signed one() {
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a, b;
    for (int i = 0; i < n; i++) {
        int l, v;
        cin >> l >> v;
        a.resize(sz(a) + l, v);
    }
    for (int i = 0; i < m; i++) {
        int l, v;
        cin >> l >> v;
        b.resize(sz(b) + l, v);
    }

    fill(nxta[N], nxta[N] + MAXK, N);
    for (int i = N - 1; i >= 0; i--) {
        copy(nxta[i + 1], nxta[i + 1] + MAXK, nxta[i]);
        nxta[i][a[i]] = i;
    }
    fill(nxtb[M], nxtb[M] + MAXK, M);
    for (int i = M - 1; i >= 0; i--) {
        copy(nxtb[i + 1], nxtb[i + 1] + MAXK, nxtb[i]);
        nxtb[i][b[i]] = i;
    }
    for (int i = N - 1; i >= 0; i--) {
        for (int j = M - 1; j >= 0; j--) {
            for (int v = 1; v <= k; v++) {
                if (nxta[i][v] != N && nxtb[i][v] != M)
                    dp[i][j] |= !dp[nxta[i][v] + 1][nxtb[j][v] + 1];
            }
        }
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        cout << (dp[x][y] ? "Yes\n" : "No\n");
    }
    return 0;
}



signed main() {
#ifndef DEBUG
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    signed t;
    t = 1;
    while (t--) {
        signed retcode = one();
        if (retcode) return retcode;
    }
    return 0;
}
