#include <bits/stdc++.h>
using namespace std;
#define ll long long
struct seg{ll l, v;};
pair<ll, ll> sus(ll x, vector<ll>& pla)
{
    auto i = upper_bound(pla.begin(), pla.end(), x) - pla.begin();
    return {i, pla[i] - x};
}
int main()
{
    ll N, M, m, k, q, n;
    cin >> N >> n >>  M >> m >> k >> q;
    vector<seg> a(n), b(n);
    for (auto &[l, v] : a) cin >> l >> v;
    for (auto &[l, v] : b) cin >> l >> v;
    vector<vector<ll>> dp(n + 1, vector<ll> (m + 1, 0));
    for (ll i = n - 1; i >= 0; i--)
        for (ll j = m - 1; j >= 0; j--)
        {
            if (a[i].v == a[j].v)
            {
                ll res = dp[i + 1][j + 1];
                ll minln = min(a[i].l, a[j].l);
                dp[i][j] = res || (minln & 1);
            }
            else
                dp[i][j] = dp[i + 1][j] || dp[i][j + 1];
        }
    vector<ll> pla(n), plb(m);
    pla[0] = a[0].l, plb[0] = b[0].l;
    for (ll i = 1; i < n; i++)
        pla[i] = pla[i - 1] + a[i].l;
    for (ll i = 1; i < m; i++)
        plb[i] = plb[i - 1] + b[i].l;

    while (q--)
    {
        ll x, y;
        cin >> x >> y;
        auto [ax, al] = sus(x,pla);
        auto [bx, bl] = sus(y, plb);
        ll res = dp[ax + 1][bx + 1];
        ll ln = min(al, bl);
        if (res || (ln & 1))
            cout << "Yes\n";
        else cout << "No\n";
    }

}
