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

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;

#define all(a) a.begin(), a.end()

using ordered_set = tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

void solve();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef _GLIBCXX_DEBUG
    freopen("input", "r", stdin);
#endif
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
}

void solve() {
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a(N), b(M);
    int p1 = 0, p2 = 0;
    for (int i = 0; i < n; i++) {
        int l, v;
        cin >> l >> v;
        for (int i = p1; i < p1 + l; i++)
            a[i] = v;
        p1 += l;
    }
    for (int i = 0; i < n; i++) {
        int l, v;
        cin >> l >> v;
        for (int i = p2; i < p2 + l; i++)
            b[i] = v;
        p2 += l;
    }
    vector<vector<int>> dp(N, vector<int>(M));
    vector<int> cnt(k + 1);
    int c = 0;
    vector<int> nxt(k + 1, -1), nxt1(k + 1);
    for (int i = N - 1; i >= 0; i--) {
        c = 0;
        for (int &j: cnt)
            j = 0;
        for (int &j: nxt1)
            j = 0;
        for (int j = M - 1; j >= 0; j--) {
            if (c)
                dp[i][j] = 1;
            if (nxt1[b[j]] != -1) {
                c -= cnt[b[j]];
                cnt[b[j]] = 0;
            }
            nxt1[b[j]] = j;
            if (nxt[b[j]] != -1 && dp[nxt[b[j]]][nxt1[b[j]]] == 0) {
                cnt[b[j]] = 1;
                c++;
            }
        }
        nxt[a[i]] = i;
    }
    while (q--) {
        int l, r;
        cin >> l >> r;
        if (dp[l][r] == 0)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
}