#include <iostream>
#include <random>
#include <numeric>
#include <algorithm>
#include <vector>
#include <map>
#include <set>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr int maxn = 5010;
int N, M, n, m, k;
int a[maxn], b[maxn];
bool dp[maxn][maxn];
vector<int> all_vals;
int a_can[maxn * 2], b_can[maxn * 2];

int zip(int x) {
    return lower_bound(all_vals.begin(), all_vals.end(), x) - all_vals.begin();
}

void solve() {
    int q;
    cin >> N >> n >> M >> m >> k >> q;
    for (int i = 0, pl = 0, l, v; i < n; ++i) {
        cin >> l >> v;
        all_vals.push_back(v);
        for (int j = pl; j < pl + l; ++j) a[j] = v;
        pl += l;
    }
    for (int i = 0, pl = 0, l, v; i < m; ++i) {
        cin >> l >> v;
        all_vals.push_back(v);
        for (int j = pl; j < pl + l; ++j) b[j] = v;
        pl += l;
    }
    sort(all_vals.begin(), all_vals.end());
    all_vals.erase(unique(all_vals.begin(), all_vals.end()), all_vals.end());
    for (int i = 0; i < N; ++i) a[i] = zip(a[i]);
    for (int i = 0; i < M; ++i) b[i] = zip(b[i]);
    k = all_vals.size();
    for (int i = 0; i < k; ++i) a_can[i] = -1;
    for (int i = N - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j) b_can[j] = -1;
        a_can[a[i]] = i;
        int lose_cnt = 0;
        for (int j = M - 1; j >= 0; --j) {
            if (a_can[b[j]] != -1 && b_can[b[j]] != -1 && !dp[a_can[b[j]] + 1][b_can[b[j]] + 1]) --lose_cnt;
            b_can[b[j]] = j;
            if (a_can[b[j]] != -1 && !dp[a_can[b[j]] + 1][b_can[b[j]] + 1]) ++lose_cnt;
            dp[i][j] = lose_cnt > 0;
        }
    }
    for (int i = 0, x, y; i < q; ++i) {
        cin >> x >> y;
        if (dp[x][y]) cout << "Yes\n";
        else cout << "No\n";
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll t = 1;
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    cin >> t;
#else
#ifdef TEST
    freopen("input.txt", "r", stdin);
#else
#endif
#endif
    while (t--) {
        solve();
        cout << "\n";
    }
    return 0;
}
