#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
mt19937 rnd1(chrono::high_resolution_clock::now().time_since_epoch().count());
mt19937 rnd(100);

ll n, m, k;
vector<ll> vals, arr1, arr2;
vector<vector<ll>> dp, next1, next2;

bool f(ll a, ll b) {
    if (a == n || b == m)
        return 0;

    if (dp[a][b] != -1)
        return dp[a][b];

    bool ans = 0;
    for (int i = 0; i < k; ++i) {
        ll x = next1[a][i], y = next2[b][i];
        if (x == n || y == m)
            continue;

        x++, y++;
        ans = ans || !f(x, y);
    }

    dp[a][b] = ans;
    return ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll N, M, q, len, val, x, y;
    cin >> N >> n >> M >> m >> k >> q;
    dp.assign(N, *new vector<ll>(M, -1));
    next1.assign(N, *new vector<ll>(k, n));
    next2.assign(M, *new vector<ll>(k, m));
    set<ll> vals0;
    for (int i = 0; i < n; ++i) {
        cin >> len >> val;
        vals0.insert(val);
        for (int j = 0; j < len; ++j)
            arr1.push_back(val);
    }

    for (int i = 0; i < m; ++i) {
        cin >> len >> val;
        vals0.insert(val);
        for (int j = 0; j < len; ++j)
            arr2.push_back(val);
    }

    map<ll, ll> tf;
    for (ll i: vals0)
        tf[i] = vals.size(), vals.push_back(i);

    n = arr1.size();
    m = arr2.size();

    vector<ll> last1(k, n), last2(k, m);
    for (int i = n - 1; i >= 0; --i) {
        last1[tf[arr1[i]]] = i;
        for (int j = 0; j < k; ++j)
            next1[i][j] = last1[j];
    }

    for (int i = m - 1; i >= 0; --i) {
        last2[tf[arr2[i]]] = i;
        for (int j = 0; j < k; ++j)
            next2[i][j] = last2[j];
    }

    arr1.push_back(-1);
    arr2.push_back(-1);
    for (int i = 0; i < q; ++i) {
        cin >> x >> y;
        cout << (f(x, y) ? "Yes\n" : "No\n");
    }

    return 0;
}

/*
5 1 5 1 1 9
5 1
5 1
0 0
0 1
0 2
1 0
1 1
1 2
2 0
2 1
2 2

7 3 7 3 2 12
2 1
3 2
2 1
2 2
3 1
2 2
0 2
0 3
0 4
1 2
1 3
1 4
2 5
2 6
3 5
3 6
4 5
4 6

*/
/*
Ситуация - мы не можем использовать первые А и вторые Б элементов.
Действие - взять букву скипнув все до первого вхождения ее и туда и туда.

*/
/*


*/
/*


*/
/*


*/