
#pragma GCC optimize("O3,unroll-loops,inline")

#include <bits/allocator.h>

#pragma GCC target("avx2,popcnt")

#include <bits/stdc++.h>

using namespace std;

//#define int long long
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using ull = unsigned long long;

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmax(T &a, const T &b) {
    if (b > a) {
        a = b;
        return true;
    }
    return false;
}

mt19937 rnd(228);

constexpr int N = 5e3;

int mp[N + 1][N + 1], which[N + 1][N + 1];
int an[N + 1][2 * N + 1], bn[N + 1][2 * N + 1], xx[2 * N + 1];

void solve() {
    int n, ln, m, lm, k, q;
    cin >> n >> ln >> m >> lm >> k >> q;
    vector<int> a, b;
    for (int i = 0, l, x; i < ln; ++i) {
        cin >> l >> x;
        --x;
        while (l--)
            a.push_back(x);
    }
    for (int i = 0, l, x; i < lm; ++i) {
        cin >> l >> x;
        --x;
        while (l--)
            b.push_back(x);
    }
    vector<int> x;
    for (int i : a)
        x.push_back(i);
    for (int i : b)
        x.push_back(i);
    sort(all(x));
    x.resize(unique(all(x)) - x.begin());
    for (int &i : a) i = lower_bound(all(x), i) - x.begin();
    for (int &i : b) i = lower_bound(all(x), i) - x.begin();
    k = x.size();
//    int n, m, k, q;
//    cin >> n >> m >> k >> q;
//    vector<int> a(n);
//    for (int &i : a)
//        cin >> i, --i;
//    vector<int> b(m);
//    for (int &i : b)
//        cin >> i, --i;
    fill(xx, xx + k, n);
    for (int i = n - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j)
            an[i + 1][j] = xx[j];
        xx[a[i]] = i;
    }
    for (int j = 0; j < k; ++j)
        an[0][j] = xx[j];
    fill(xx, xx + k, m);
    for (int i = m - 1; i >= 0; --i) {
        for (int j = 0; j < k; ++j)
            bn[i + 1][j] = xx[j];
        xx[b[i]] = i;
    }
    for (int j = 0; j < k; ++j)
        bn[0][j] = xx[j];
    vector<int> o(k);
    iota(all(o), 0);
    shuffle(all(o), rnd);
    for (int i = n - 1; i >= -1; --i)
        for (int j = m - 1; j >= -1; --j) {
            if (a[i] != b[j])
                continue;
            int nx = -1;
            if (i < n - 1 && a[i + 1] == a[i])
                nx = which[i + 2][j + 1];
            if (j < m - 1 && b[j + 1] == b[j])
                nx = which[i + 1][j + 2];
            which[i + 1][j + 1] = -1;
            bool f = true;
            if (nx != -1 && nx != a[i]) {
                if (an[i + 1][nx] < n && bn[j + 1][nx] < m) {
                    f &= mp[an[i + 1][nx] + 1][bn[j + 1][nx] + 1];
                    if (!f)
                        which[i + 1][j + 1] = nx;
                }
            } else {
                if (an[i + 1][a[i]] < n && bn[j + 1][a[i]] < m) {
                    f &= mp[an[i + 1][a[i]] + 1][bn[j + 1][a[i]] + 1];
                    if (!f)
                        which[i + 1][j + 1] = a[i];
                }
                for (int z = 0; f && z < k; ++z)
                    if (an[i + 1][o[z]] < n && bn[j + 1][o[z]] < m) {
                        f &= mp[an[i + 1][o[z]] + 1][bn[j + 1][o[z]] + 1];
                        if (!f)
                            which[i + 1][j + 1] = o[z];
                    }
            }
            mp[i + 1][j + 1] = !f;
        }
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (x > 0 && y > 0 && a[x - 1] == b[y - 1]) {
            cout << (mp[x][y] ? "Yes" : "No") << '\n';
            continue;
        }
        bool f = true;
        for (int z = 0; f && z < k; ++z)
            if (an[x][o[z]] < n && bn[y][o[z]] < m)
                f &= mp[an[x][o[z]] + 1][bn[y][o[z]] + 1];
        cout << (!f ? "Yes" : "No") << '\n';
    }
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int t = 1;
//     cin >> t;
    while (t--) solve();
//    cerr << fixed << setprecision(10) << clock() * 1.0 / CLOCKS_PER_SEC << '\n';
}
