#include <bits/extc++.h>
#define int long long
using namespace std;
using namespace __gnu_pbds;
bool dp[3003][3003], used[3003][3003];
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, n, M, m, k, q; cin >> N >> n >> M >> m >> k >> q;
    vector<int> a(N + 1), b(M + 1);
    int last = 0;
    for (int i = 1; i <= n; ++i) {
        int len; cin >> len;
        int val; cin >> val;
        for (int j = last + 1; j <= last + len; ++j) a[j] = val;
        last += len;
    }
    vector<int> g1[k + 1], g2[k + 1];
    for (int i = 1; i <= N; ++i) g1[a[i]].push_back(i);
    last = 0;
    for (int i = 1; i <= m; ++i) {
        int len; cin >> len;
        int val; cin >> val;
        for (int j = last + 1; j <= last + len; ++j) b[j] = val;
        last += len;
    }
    for (int i = 1; i <= M; ++i) g2[b[i]].push_back(i);
    function<bool(int, int)> f = [&](int f1, int f2) {
        if (f1 > N || f2 > M) {
            return false;
        }
        if (used[f1][f2] == true) {
            return dp[f1][f2];
        }
        used[f1][f2] = true;
        for (int nxt = 1; nxt <= k; ++nxt) {
            auto it = lower_bound(g1[nxt].begin(), g1[nxt].end(), f1) - g1[nxt].begin();
            auto itt = lower_bound(g2[nxt].begin(), g2[nxt].end(), f2) - g2[nxt].begin();
       // cout << nxt << ' ' << itt << ' ' <<g2[nxt].size() << ' '<< g2[nxt].back() << ' '<< f2 << endl;
            if (it < g1[nxt].size() && itt < g2[nxt].size()) {
              //  cout << g1[nxt][it] << ' '<< g2[nxt][itt] << endl;
                if (f(g1[nxt][it] + 1, g2[nxt][itt] + 1) == false) {
                    return dp[f1][f2] = true;
                }
            }
        }
        return dp[f1][f2] = false;
    };
    while (q--) {
        int x, y; cin >> x >> y;
        x++, y++;
        if (f(x, y)) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}
