#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <unordered_map>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>

#define all(v) v.begin(), v.end()
#define len(v) (int)v.size()

using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

struct obj
{
    int x, len;
};

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<obj> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i].len >> a[i].x;
    }
    vector<obj> b(m);
    for (int i = 0; i < m; ++i)
    {
        cin >> b[i].len >> b[i].x;
    }
    vector<int> arra;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < a[i].len; ++j)
        {
            arra.push_back(a[i].x);
        }
    }
    vector<int> arrb;
    for (int i = 0; i < m; ++i)
    {
        for (int j = 0; j < b[i].len; ++j)
        {
            arrb.push_back(b[i].x);
        }
    }
    vector<vector<bool>> dp(N, vector<bool>(M));
    vector<int> lasta(k + 1, -1);
    set<pair<int, int>> st;
    for (int i = N - 1; i >= 0; --i)
    {
        lasta[arra[i]] = i;
        vector<int> lastb(k + 1, -1);
        st.clear();
        for (int j = M - 1; j >= 0; --j)
        {
            if (lasta[arrb[j]] != -1)
            {
                st.erase({lasta[arrb[j]], lastb[arrb[j]]});
                int i1 = lasta[arrb[j]], j1 = j;
                if (i1 == N - 1 || j1 == M - 1 || !dp[i1 + 1][j1 + 1])
                {
                    st.insert({i1, j1});
                }
            }
            lastb[arrb[j]] = j;
            /*for (int u = 1; u <= k; ++u)
            {
                if (lasta[u] != -1 && lastb[u] != -1)
                {
                    int i1 = lasta[u], j1 = lastb[u];
                    if (i1 == N - 1 || j1 == M - 1 || !dp[i1 + 1][j1 + 1])
                    {
                        dp[i][j] = 1;
                        break;
                    }
                }
            }*/
            if (!st.empty())
            {
                dp[i][j] = 1;
            }
        }
    }
    for (int i = 0; i < q; ++i)
    {
        int x, y;
        cin >> x >> y;
        if (dp[x][y])
        {
            cout << "Yes\n";
        } else
        {
            cout << "No\n";
        }
    }

    return 0;
}

