// semenInRussia 2025
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

const int maxn = 5005;
int a[maxn], b[maxn];

const int K = 5005;
int nxta[maxn][K], nxtb[maxn][K];

bool dp[maxn][maxn][2];

int n, m;

void read() {
  vector<pair<int, int>> as(n), bs(m);
  vector<int> ps(n + m + 1);
  int pref = 0;
  for (int i = 0; i < n; i++) {
    int l, v;
    cin >> l >> v;
    --v;
    as[i] = {l, v};
    pref += l;
    ps[i] = pref;
  }

  for (int i = 0; i < m; i++) {
    int l, v;
    cin >> l >> v;
    --v;
    bs[i] = {l, v};
    pref += l;
    ps[i + n] = pref;
  }

  sort(ps.begin(), ps.end());
  int u = unique(ps.begin(), ps.end()) - ps.begin();
  ps.resize(u);

  int lef = 0;
  int rig = 0;
  for (auto [l, v] : as) {
    rig += l;
    int l1 = lower_bound(ps.begin(), ps.end(), lef) - ps.begin();
    int r1 = lower_bound(ps.begin(), ps.end(), rig) - ps.begin();
    for (int i = lef; i < rig; i++) {
      a[i] = v;
    }
    lef += l;
  }
  n = rig;

  lef = 0;
  rig = 0;
  for (auto [l, v] : bs) {
    rig += l;
    int l1 = lower_bound(ps.begin(), ps.end(), lef) - ps.begin();
    int r1 = lower_bound(ps.begin(), ps.end(), rig) - ps.begin();
    for (int i = lef; i < rig; i++) {
      b[i] = v;
    }
    lef += l;
  }
  m = rig;
}

int main() {
  int N, M, k, q;
  cin >> N >> n >> M >> m >> k >> q;

  read();

  for (int j = 0; j < k; j++) {
    nxta[n][j] = n;
    nxtb[m][j] = m;
  }

  for (int i = n - 1; i >= 0; i--) {
    for (int l = 0; l < k; l++) {
      nxta[i][l] = nxta[i + 1][l];
      if (a[i] == l) {
        nxta[i][l] = i;
      }
    }
  }

  for (int i = m - 1; i >= 0; i--) {
    for (int l = 0; l < k; l++) {
      nxtb[i][l] = nxtb[i + 1][l];
      if (b[i] == l) {
        nxtb[i][l] = i;
      }
    }
  }

  for (int i = n - 1; i >= 0; i--) {
    for (int p = 0; p <= 1; p++) {
      int j = 0;
      int cnt = 0;
      for (int v = 0; v < k; v++) {
        int ip = nxta[i][v] + 1;
        int jp = nxtb[j][v] + 1;
        if (ip == n + 1 || jp == m + 1) {
          continue;
        }
        cnt += !dp[ip][jp][p ^ 1];
      }
      for (j = 0; j < m; j++) {
        if (j > 0) {
          // we delete occurance of b[j]
          int v = b[j - 1];
          int ip = nxta[i][v] + 1;
          int jp = nxtb[j][v] + 1;
          if (ip != n + 1 && jp != m + 1) {
            if (!dp[ip][jp][p ^ 1]) {
              cnt++;
            }
          }
        }
        dp[i][j][p] = cnt > 0;
        // cerr << "(" << i << ", " << j << ") => " << "(" << ip << ", " << jp
        //      << ")\n";
        // assert(ip > i && jp > j);

        // we delete occurance of b[j]
        int v = b[j];
        int ip = nxta[i][v] + 1;
        int jp = nxtb[j][v] + 1;
        if (ip != n + 1 && jp != m + 1) {
          if (!dp[ip][jp][p ^ 1]) {
            cnt--;
          }
        }
      }
    }
  }

  while (q--) {
    int aa, bb;
    cin >> aa >> bb;
    bool ans = dp[aa][bb][0];
    cout << (ans ? "Yes\n" : "No\n");
  }
}