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

using namespace std;
//using namespace __gnu_pbds;

//template<typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define rs resize
#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long

typedef long double ld;
typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template<typename T>
istream &operator >>(istream &in, pair<T, T> &a) {
    in >> a.ff >> a.ss;
    return in;
}

template<typename T>
ostream &operator <<(ostream &out, pair<T, T> &a) {
    out << a.ff << " " << a.ss;
    return out;
}

template<typename T>
istream &operator >>(istream &in, vector<T> &a) {
    for (auto &i : a) in >> i;
    return in;
}

template<typename T>
ostream &operator <<(ostream &out, vector<T> &a) {
    for (auto i : a) cout << i << " ";
    return out;
}

const int maxn = 5010, maxk = 1610;
int dp[maxn][maxn], c[maxk], lt[maxn], f[maxn][maxn];
void solve() {
    int N, n, M, m, k, q; cin >> N >> n >> M >> m >> k >> q;

    vector<int> s1, s2;
    for (int i = 0; i < n; i++) {
        int a, b; cin >> a >> b;
        for (int j = 0; j < a; j++) s1.pb(b);
    }
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        for (int j = 0; j < a; j++) s2.pb(b);
    }

    map<pii, int> d;
    for (int i = 0; i < q; i++) {
        int a, b; cin >> a >> b;
        f[a][b] = 1;
        d[{a, b}] = i;
    }

    vector<int> ans(q);
    for (int i = N - 1; i > -1; i--) {
        int sm = 0;
        for (int j = M - 1; j > -1; j--) {
            if (s1[i] == s2[j]) {
                if (sm == 0) dp[i][j] = 1;
            }
            if (lt[j] != 0) {
                if (dp[lt[j]][j]) {
                    c[s2[j]] = 1; sm++;
                } else {
                    sm -= c[s2[j]];
                    c[s2[j]] = 0;
                }
            }
            if (s1[i] == s2[j]) {
                lt[j] = i;
            }

            if (f[i][j]) {
                int cnt = 0;
                for (int l = 1; l <= k; l++) if (l != s1[i] && c[l]) cnt++;

                if (dp[i][j] || cnt != 0) ans[d[{i, j}]] = 1;
                else ans[d[{i, j}]] = 0;
            }

        }
    }
    for (int i = 0; i < q; i++) {
        if (ans[i]) cout << "Yes\n";
        else cout << "No\n";
    }
}

int32_t main() {
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#endif
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    double tim = clock();
#endif

    int tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
#ifdef LOCAL
        cout << "-------------------\n";
#endif
    }

#ifdef LOCAL
    cout << (double)(clock() - tim) / CLOCKS_PER_SEC;
#endif
}
