
#pragma GCC optmize("Ofast, inline, unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;

template <typename T>
void sort(T &s) {
    sort(all(s));
}

template<typename T>
void rsort(T &s) {
    sort(rall(s));
}

const int inf = 2e9 + 2000;
const ll infll = 2e18 + 2000;
const int R = (1 << 20);
mt19937 rnd(26);

template <typename T>
struct point {
    T x, y;
    point(T x, T y) : x(x), y(y) {}
    point(point a, point b) : x(b.x - a.x), y(b.y - a.y) {}

    point operator + (point &o) const {
        return {x + o.x, y + o.y};
    }

    point operator * (const T k) const {
        return {x * k, y * k};
    }

    T operator * (const point &o) const {
        return x * o.x + y * o.y;
    }

    T operator % (const point &o) const {
        return x * o.y - y * o.x;
    }

    T len2() {
        return x * x + y * y;
    }

    ld len() {
        return sqrt(x * x + y * y);
    }
};



void solve() {
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;

    vector<int> a(N);
    vector<int> b(M);

    vector<vector<int> > nua(k + 1), nub(k + 1);

    int uk = 0;
    for (int i = 0; i < n; ++i) {
        int ko, v;
        cin >> ko >> v;

        for (int j = 0; j < ko; ++j) {
            a[j + uk] = v;
            nua[v].push_back(j + uk);
        }
        uk += ko;
    }
    
    uk = 0;
    for (int i = 0; i < m; ++i) {
        int ko, v;
        cin >> ko >> v;

        for (int j = 0; j < ko; ++j) {
            b[j + uk] = v;
            nub[v].push_back(j + uk);
        }
        uk += ko;
    }

    vector<vector<int> > dp(N, vector<int> (M, false));
    vector<int> nea(k + 1, -1), neb(k + 1, -1);

    vector<bool> sa(k + 1), sb(k + 1), se(k + 1);
    vector<int> v;
    
    for (int i = N - 1; i >= 0; --i) {
        neb.assign(k + 1, -1);
        v.clear();
        sb.assign(k + 1, false);
        se.assign(k + 1, false);

        for (int j = M - 1; j >= 0; --j) {
            if (a[i] == b[j]) {
                bool fl = false;
                for (auto u : v) {
                    if (!dp[nea[u]][neb[u]]) {
                        fl = true;
                        break;
                    }
                }
                dp[i][j] = fl;
            }

            neb[b[j]] = j;
            sb[b[j]] = true;
            if (sa[b[j]]) {
                if (!se[b[j]]) {
                    v.push_back(b[j]);
                }
                se[b[j]] = true;
            }
        }
        nea[a[i]] = i;
        sa[a[i]] = true;
    }

    while (q--) {
        int x, y;
        cin >> x >> y;

        bool fl = false;
        for (int i = 1; i <= k; ++i) {
            auto r1 = lower_bound(all(nua[i]), x);
            auto r2 = lower_bound(all(nub[i]), y);

            if (r1 != nua[i].end() && r2 != nub[i].end()) {
                if (!dp[*r1][*r2]) {
                    fl = true;
                    break;
                }
            }
        }

        if (fl) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int tt = 1;
    // cin >> tt;

    while (tt--) {
        solve();
    }
}
