#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 = 5010, 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;
    int la1, _, lb1;
    cin >> la1 >> _;
    vector<int> a(500, 1), b(500, 1);
    for (int i = 0; i < n - 1; i++) {
        int l, v;
        cin >> l >> v;
        a.resize(sz(a) + l, v);
    }
    cin >> lb1 >> _;
    for (int i = 0; i < m - 1; 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;
    }
    vector<bool> is_good_val(k + 1, 0);
    for (int i = N - 1; i >= 0; i--) {
        fill(allv(is_good_val), 0);
        int cnt_val_good = 0;
        for (int j = M - 1; j >= 0; j--) {
            cnt_val_good -= is_good_val[b[j]];
            is_good_val[b[j]] = (nxta[i][b[j]] != N && !dp[nxta[i][b[j]] + 1][j + 1]);
            cnt_val_good += is_good_val[b[j]];
            dp[i][j] = (cnt_val_good > 0);
        }
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (x >= la1)
            smax(y, lb1);
        if (y >= lb1)
            smax(x, la1);
        if (x >= la1)
            cout << (dp[x - la1 + 500][y - lb1 + 500] ? "Yes\n" : "No\n");
        else {
            bool ans1 = dp[500][500];
            bool ans2;
            if (la1 - x <= lb1 - y)
                ans2 = ((la1 - x) & 1) ^ dp[500][500 - min(500, lb1 - y)];
            else
                ans2 = ((lb1 - y) & 1) ^ dp[500 - min(500, la1 - x)][500];
            cout << (ans1 || ans2 ? "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;
}
