#include <iostream>
#include <set>
#include <vector>
#include <random>
#include <iomanip>
//#include <fstream>
#include <algorithm>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
#define int long long
const int INF = 1e18;
signed main()
{
    cin.tie(nullptr)->sync_with_stdio(false);
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a, 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);
        }
    }
    for (int i = 0; i < m; i++) {
        int l, v;
        cin >> l >> v;
        for (int j = 0; j < l; j++) {
            b.push_back(v);
        }
    }
    vector<vector<bool>> dp(N + 1, vector<bool>(M + 1));
    for (int i = N - 1; i > -1; i--) {
        for (int j = M - 1; j > -1; j--) {
            bool check = false;
            unordered_set<int> us;
            for (int i1 = i; i1 < N; i1++) {
                for (int j1 = j; j1 < M; j1++) {
                    if (a[i1] == b[j1] and us.find(a[i1]) == us.end()) {
                        us.insert(a[i1]);
                        if (a[i1] == b[j1] and !dp[i1 + 1][j1 + 1]) {
                            check = true;
                            break;
                        }
                    }
                    
                }
                if (check) break;
            }
            dp[i][j] = check;
        }
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (dp[x][y]) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }
}