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

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

}
