#include <iostream>
#include <vector>
using namespace std;


int n, m;
const int INF = 1e9;
vector<int> a, b;
vector<vector<int>> c1, c2;
vector<vector<bool>> win, used;


bool f(int i, int j) {
    if (used[i][j])
        return win[i][j];
    used[i][j] = true;
    bool flag = true;
    for (int k = i; k < n; k++) {
        if (k == i || a[k] != a[k - 1]) {
            if (c1[j][a[k]] != INF)
                flag = flag && f(k + 1, c1[j][a[k]] + 1);
        }
    }
    for (int k = j; k < m; k++) {
        if (k == j || b[k] != b[k - 1]) {
            if (c2[i][b[k]] != INF)
                flag = flag && f(c2[i][b[k]] + 1, k + 1);
        }
    }
    //cout << i << ' ' << j << " || " << !flag << '\n';
    return win[i][j] = !flag;
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int l1, l2, k, q, x, y;
    cin >> n >> l1 >> m >> l2 >> k >> q;
    for (int i = 0; i < l1; i++) {
        cin >> x >> y;
        for (int j = 0; j < x; j++)
            a.push_back(y);
    }
    for (int i = 0; i < l2; i++) {
        cin >> x >> y;
        for (int j = 0; j < x; j++)
            b.push_back(y);
    }
    c1.resize(m, vector<int>(k + 1, INF));
    c1[m - 1][b[m - 1]] = m - 1;
    for (int i = m - 2; i >= 0; i--) {
        for (int j = 0; j <= k; j++)
            c1[i][j] = c1[i + 1][j];
        c1[i][b[i]] = i;
    }
    c2.resize(n, vector<int>(k + 1, INF));
    c2[n - 1][a[n - 1]] = n - 1;
    for (int i = n - 2; i >= 0; i--) {
        for (int j = 0; j <= k; j++)
            c2[i][j] = c2[i + 1][j];
        c2[i][a[i]] = i;
    }
    win.resize(n + 1, vector<bool>(m + 1, false));
    used.resize(n + 1, vector<bool>(m + 1, false));
    for (int i = 0; i < n; i++)
        used[i][m] = true;
    for (int i = 0; i < m; i++)
        used[n][i] = true;
    for (int i = 0; i < q; i++) {
        cin >> x >> y;
        if (f(x, y))
            cout << "Yes" << '\n';
        else
            cout << "No" << '\n';
    }
}

