#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef string str;
mt19937 rnd(157);

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

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

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a;
    vector<int> b;
    for(int i = 0; i < n; i++) {
        int l, v;
        cin >> l >> v;
        for(int j = 0; j < l; j++) {
            a.push_back(v - 1);
        }
    }
    for(int i = 0; i < m; i++) {
        int l, v;
        cin >> l >> v;
        for(int j = 0; j < l; j++) {
            b.push_back(v - 1);
        }
    }
    vector<vector<int>> win(N + 1, vector<int> (M + 1, 0));
    vector<int> last1(k, -1);
    for(int i = N; i >= 0; --i) {
        vector<int> last2(k, -1);
        for(int j = M; j >= 0; --j) {
            if((i > 0 && j > 0 && a[i - 1] == b[j - 1]) || (i == 0 && j == 0)) {
                for (int col = 0; col < k; col++) {
                    if (last1[col] != -1 && last2[col] != -1) {
                        win[i][j] |= !win[last1[col]][last2[col]];
                    }
                }
            }
            if(j != 0) {
                last2[b[j - 1]] = j;
            }
        }
        if(i != 0) {
            last1[a[i - 1]] = i;
        }
    }

    while(q--) {
        int x, y;
        cin >> x >> y;
        if(win[x][y]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}
