//#include <bits/stdc++.h>
//using namespace std;
//typedef long long ll;
//
//struct segtree {
//    ll n;
//    vector<ll> t;
//
//    segtree() {}
//
//    segtree(vector<ll>& in) {
//        n = in.size();
//        t.resize(4 * n);
//        build(0, 0, n - 1, in);
//    }
//
//    void build(ll v, ll tl, ll tr, vector<ll>& in) {
//        if (tl == tr) {
//            t[v] = in[tl];
//            return;
//        }
//        ll tm = (tl + tr) / 2;
//        build(2 * v + 1, tl, tm, in);
//        build(2 * v + 2, tm + 1, tr, in);
//        t[v] = t[2 * v + 1] + t[2 * v + 2];
//    }
//
//    ll get(ll v, ll tl, ll tr, ll l, ll r) {
//        if (l <= tl && tr <= r) {
//            return t[v];
//        }
//        if (tr < l || r < tl) {
//            return 0;
//        }
//        ll tm = (tl + tr) / 2;
//        return get(2 * v + 1, tl, tm, l, r) + get(2 * v + 2, tm + 1, tr, l, r);
//    }
//
//    void upd(ll val, ll idx, ll v, ll tl, ll tr) {
//        if (tl == idx && idx == tr) {
//            t[v] = val;
//            return;
//        }
//        if (tr < idx || idx < tl) {
//            return;
//        }
//        ll tm = (tl + tr) / 2;
//        upd(val, idx, 2 * v + 1, tl, tm);
//        upd(val, idx, 2 * v + 2, tm + 1, tr);
//        t[v] = t[2 * v + 1] + t[2 * v + 2];
//    }
//
//    ll get(ll l, ll r) {
//        return get(0, 0, n - 1, l, r);
//    }
//
//    void upd(ll val, ll idx) {
//        upd(val, idx, 0, 0, n - 1);
//    }
//};
//
//// B
////ll m, n; cin >> m >> n;
////vector<ll> a(n + 1);
////for (int i = 0; i < n; i++) cin >> a[i];
////reverse(a.begin(),a.end());
////vector<vector<ll>> dp(n + 1, vector<ll> (m + 1, -INF));
////dp[0][0] = 0;
////for (int i = 0; i < n; i++) {
////for (int j = 0; j <= m; j++) {
////if (dp[i][j] == -INF) continue;
////if (j > 0) {
////dp[i + 1][j - 1] = max(dp[i + 1][j - 1], dp[i][j] - a[i + 1]);
////}
////if (j < m) {
////dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + a[i + 1]);
////}
////}
////}
////ll ans = -INF;
////for (int j = 0; j <= m; j++) {
////ans = max(ans, dp[n][j]);
////}
////cout << ans << '\n';
//
//// C
////const ll INF = 1e18;
////const ll N = 3e5 + 5;
////
////vector<ll> g[N];
////ll par[N], s[N], die[N];
////
////ll sz[N], ans[N];
////
////void solve() {
////    ll n, q; cin >> n >> q;
////    for (int i = 1; i < n; i++) {
////        ll p; cin >> p; p--;
////        par[i] = p;
////        g[p].push_back(i);
////    }
////    for (int i = 0; i < n; i++) cin >> s[i];
////
////    set<pair<ll, ll>> cur;
////    cur.insert({s[0], 0});
////    vector<ll> ord;
////    while (!cur.empty()) {
////        auto v = (*cur.rbegin()).second;
////        cur.erase({s[v], v});
////        ord.push_back(v);
////        for (auto to : g[v]) {
////            cur.insert({s[to], to});
////        }
////    }
////    for (int i = 0; i < n; i++) {
////        die[ord[i]] = i;
////    }
////
////    multiset<ll> curSz;
////    vector<ll> ps;
////    for (int i = 0; i < n; i++) {
////        ll v = ord[i];
////
////        ll goV = v;
////        while (true) {
////            ps.push_back(goV);
////            if (sz[goV] != 0) {
////                curSz.erase(curSz.find(sz[goV]));
////            }
////            sz[goV]++;
////            curSz.insert(sz[goV]);
////            if (goV == 0) break;
////            goV = par[goV];
////        }
////        for (auto p : ps) {
////            curSz.erase(curSz.find(sz[p]));
////        }
////
////        ans[v] = i;
////        if (!curSz.empty()) {
////            ans[v] = i - *curSz.rbegin();
////        }
////
////        for (auto p : ps) {
////            curSz.insert(sz[p]);
////        }
////
////        ps.clear();
////    }
////
////    while (q--) {
////        ll v; cin >> v; v--;
////        cout << ans[v] << " ";
////    }
////    cout << '\n';
////
////
////}
////
////int main() {
////    ios_base::sync_with_stdio(false); cin.tie(0);
////
////    ll tst = 1;
////    while (tst--) {
////        solve();
////    }
////}
//
//const ll INF = 1e18;
//
//void solve() {
//    ll N, n, M, m, k, q; cin >> N >> n >> M >> m >> k >> q;
//    vector<ll> a = {-1};
//    for (int i = 0; i < n; i++) {
//        ll cnt, v; cin >> cnt >> v;
//        v--;
//        for (int j = 0; j < cnt; j++) {
//            a.push_back(v);
//        }
//    }
//    vector<ll> b = {-1};
//    for (int i = 0; i < m; i++) {
//        ll cnt, v; cin >> cnt >> v;
//        v--;
//        for (int j = 0; j < cnt; j++) {
//            b.push_back(v);
//        }
//    }
//    vector<ll> all;
//    for (int i = 1; i <= N; i++) all.push_back(a[i]);
//    for (int i = 1; i <= M; i++) all.push_back(b[i]);
//    sort(all.begin(), all.end());
//    all.erase(unique(all.begin(), all.end()), all.end());
//
//    k = all.size();
//    for (int i = 1; i <= N; i++) {
//        a[i] = lower_bound(all.begin(), all.end(), a[i]) - all.begin();
//    }
//    for (int i = 1; i <= M; i++) {
//        b[i] = lower_bound(all.begin(), all.end(), b[i]) - all.begin();
//    }
//    vector<vector<ll>> nxtA(N + 1, vector<ll> (k, 0)), nxtB(M + 1, vector<ll> (k, 0));
//    vector<ll> cur(k, 0);
//    for (int i = N; i >= 1; i--) {
//        nxtA[i] = cur;
//        cur[a[i]] = i;
//    }
//    cur.assign(k, 0);
//    for (int i = M; i >= 1; i--) {
//        nxtB[i] = cur;
//        cur[b[i]] = i;
//    }
//
//    vector<vector<ll>> dp(N + 1, vector<ll> (M + 1, 1));
//    vector<vector<bool>> can(M + 1, vector<bool> (k, false));
//    vector<ll> cntCan(M + 1, 0);
//    for (int i = N; i >= 1; i--) {
//        for (int j = M; j >= 1; j--) {
//            if (a[i] != b[j]) continue;
//            dp[i][j] = (cntCan[j] > 0);
//            // cout << i << " " << j << " -- " << dp[i][j] << '\n';
//        }
//        for (int j = M; j >= 1; j--) {
//            if (a[i] != b[j]) continue;
//            cntCan[j] -= can[j][a[i]];
//            if (a[i - 1] == b[j]) {
//                can[j][a[i]] = (1 - dp[i][nxtB[j]]);
//            } else {
//                can[j][a[i]] = (1 - dp[i][j]);
//            }
//            cntCan[j] += can[j][a[i]];
//        }
//    }
//
//    vector<vector<ll>> ans(N + 1, vector<ll> (M + 1, 0));
//    for (int i = 0; i <= M; i++) {
//        can[i].assign(k, false);
//    }
//    cntCan.assign(M + 1, 0);
//    for (int i = N; i >= 1; i--) {
//        for (int j = M; j >= 1; j--) {
//            if (a[i] != b[j]) continue;
//            cntCan[j] -= can[j][a[i]];
//            can[j][a[i]] = (1 - dp[i][j]);
//            cntCan[j] += can[j][a[i]];
//        }
//
//        for (int j = M; j >= 1; j--) {
//            if (a[i] != b[j]) continue;
//            ans[i][j] = (cntCan[j] > 0);
//            // cout << i << " " << j << " -- " << ans[i][j] << '\n';
//        }
//
//    }
//
//    while (q--) {
//        ll x, y; cin >> x >> y;
//        if (ans[x + 1][y + 1]) {
//            cout << "Yes" << '\n';
//        } else {
//            cout << "No" << '\n';
//        }
//    }
//}
//
//int main() {
//    ios_base::sync_with_stdio(false); cin.tie(0);
//
//    ll tst = 1;
//    while (tst--) {
//        solve();
//    }
//}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

struct segtree {
    ll n;
    vector<ll> t;

    segtree() {}

    segtree(vector<ll>& in) {
        n = in.size();
        t.resize(4 * n);
        build(0, 0, n - 1, in);
    }

    void build(ll v, ll tl, ll tr, vector<ll>& in) {
        if (tl == tr) {
            t[v] = in[tl];
            return;
        }
        ll tm = (tl + tr) / 2;
        build(2 * v + 1, tl, tm, in);
        build(2 * v + 2, tm + 1, tr, in);
        t[v] = t[2 * v + 1] + t[2 * v + 2];
    }

    ll get(ll v, ll tl, ll tr, ll l, ll r) {
        if (l <= tl && tr <= r) {
            return t[v];
        }
        if (tr < l || r < tl) {
            return 0;
        }
        ll tm = (tl + tr) / 2;
        return get(2 * v + 1, tl, tm, l, r) + get(2 * v + 2, tm + 1, tr, l, r);
    }

    void upd(ll val, ll idx, ll v, ll tl, ll tr) {
        if (tl == idx && idx == tr) {
            t[v] = val;
            return;
        }
        if (tr < idx || idx < tl) {
            return;
        }
        ll tm = (tl + tr) / 2;
        upd(val, idx, 2 * v + 1, tl, tm);
        upd(val, idx, 2 * v + 2, tm + 1, tr);
        t[v] = t[2 * v + 1] + t[2 * v + 2];
    }

    ll get(ll l, ll r) {
        return get(0, 0, n - 1, l, r);
    }

    void upd(ll val, ll idx) {
        upd(val, idx, 0, 0, n - 1);
    }
};

// B
//ll m, n; cin >> m >> n;
//vector<ll> a(n + 1);
//for (int i = 0; i < n; i++) cin >> a[i];
//reverse(a.begin(),a.end());
//vector<vector<ll>> dp(n + 1, vector<ll> (m + 1, -INF));
//dp[0][0] = 0;
//for (int i = 0; i < n; i++) {
//for (int j = 0; j <= m; j++) {
//if (dp[i][j] == -INF) continue;
//if (j > 0) {
//dp[i + 1][j - 1] = max(dp[i + 1][j - 1], dp[i][j] - a[i + 1]);
//}
//if (j < m) {
//dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + a[i + 1]);
//}
//}
//}
//ll ans = -INF;
//for (int j = 0; j <= m; j++) {
//ans = max(ans, dp[n][j]);
//}
//cout << ans << '\n';

// C
//const ll INF = 1e18;
//const ll N = 3e5 + 5;
//
//vector<ll> g[N];
//ll par[N], s[N], die[N];
//
//ll sz[N], ans[N];
//
//void solve() {
//    ll n, q; cin >> n >> q;
//    for (int i = 1; i < n; i++) {
//        ll p; cin >> p; p--;
//        par[i] = p;
//        g[p].push_back(i);
//    }
//    for (int i = 0; i < n; i++) cin >> s[i];
//
//    set<pair<ll, ll>> cur;
//    cur.insert({s[0], 0});
//    vector<ll> ord;
//    while (!cur.empty()) {
//        auto v = (*cur.rbegin()).second;
//        cur.erase({s[v], v});
//        ord.push_back(v);
//        for (auto to : g[v]) {
//            cur.insert({s[to], to});
//        }
//    }
//    for (int i = 0; i < n; i++) {
//        die[ord[i]] = i;
//    }
//
//    multiset<ll> curSz;
//    vector<ll> ps;
//    for (int i = 0; i < n; i++) {
//        ll v = ord[i];
//
//        ll goV = v;
//        while (true) {
//            ps.push_back(goV);
//            if (sz[goV] != 0) {
//                curSz.erase(curSz.find(sz[goV]));
//            }
//            sz[goV]++;
//            curSz.insert(sz[goV]);
//            if (goV == 0) break;
//            goV = par[goV];
//        }
//        for (auto p : ps) {
//            curSz.erase(curSz.find(sz[p]));
//        }
//
//        ans[v] = i;
//        if (!curSz.empty()) {
//            ans[v] = i - *curSz.rbegin();
//        }
//
//        for (auto p : ps) {
//            curSz.insert(sz[p]);
//        }
//
//        ps.clear();
//    }
//
//    while (q--) {
//        ll v; cin >> v; v--;
//        cout << ans[v] << " ";
//    }
//    cout << '\n';
//
//
//}
//
//int main() {
//    ios_base::sync_with_stdio(false); cin.tie(0);
//
//    ll tst = 1;
//    while (tst--) {
//        solve();
//    }
//}

const ll INF = 1e18;

void solve() {
    ll N, n, M, m, k, q; cin >> N >> n >> M >> m >> k >> q;
    vector<ll> a = {-1};
    for (int i = 0; i < n; i++) {
        ll cnt, v; cin >> cnt >> v;
        v--;
        for (int j = 0; j < cnt; j++) {
            a.push_back(v);
        }
    }
    vector<ll> b = {-1};
    for (int i = 0; i < m; i++) {
        ll cnt, v; cin >> cnt >> v;
        v--;
        for (int j = 0; j < cnt; j++) {
            b.push_back(v);
        }
    }
    vector<ll> all;
    for (int i = 1; i <= N; i++) all.push_back(a[i]);
    for (int i = 1; i <= M; i++) all.push_back(b[i]);
    sort(all.begin(), all.end());
    all.erase(unique(all.begin(), all.end()), all.end());

    k = all.size();
    for (int i = 1; i <= N; i++) {
        a[i] = lower_bound(all.begin(), all.end(), a[i]) - all.begin();
    }
    for (int i = 1; i <= M; i++) {
        b[i] = lower_bound(all.begin(), all.end(), b[i]) - all.begin();
    }
    vector<vector<ll>> nxtA(N + 1, vector<ll> (k, 0)), nxtB(M + 1, vector<ll> (k, 0));
    vector<ll> cur(k, 0);
    for (int i = N; i >= 1; i--) {
        nxtA[i] = cur;
        cur[a[i]] = i;
    }
    cur.assign(k, 0);
    for (int i = M; i >= 1; i--) {
        nxtB[i] = cur;
        cur[b[i]] = i;
    }

    vector<vector<ll>> dp(N + 1, vector<ll> (M + 1, 1)), ans(N + 1, vector<ll> (M + 1, 0));
    for (int i = N; i >= 1; i--) {
        for (int j = M; j >= 1; j--) {
            if (a[i] != b[j]) continue;
            bool ok = false;
            for (int x = 0; x < k; x++) {
                if (!dp[nxtA[i][x]][nxtB[j][x]]) {
                    ok = true;
                    break;
                }
            }
            if (!ok) dp[i][j] = 0;

            ans[i][j] = (!dp[i][j]);
            for (int x = 0; x < k; x++) {
                if (a[i] == x) continue;
                if (!dp[nxtA[i][x]][nxtB[j][x]]) {
                    ans[i][j] = 1;
                    break;
                }
            }
        }
    }

    while (q--) {
        ll x, y; cin >> x >> y;
        if (ans[x + 1][y + 1]) {
            cout << "Yes" << '\n';
        } else {
            cout << "No" << '\n';
        }
    }
}

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

    ll tst = 1;
    while (tst--) {
        solve();
    }
}