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

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

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

int uu[maxn * 2];

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

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

  int sz = 0;

  N = 0;
  for (int i = 0; i < n; i++) {
    int l, v;
    cin >> l >> v;
    while (l--) {
      a[N++] = v;
    }
    uu[sz++] = v;
  }

  M = 0;
  for (int i = 0; i < m; i++) {
    int l, v;
    cin >> l >> v;
    while (l--) {
      b[M++] = v;
    }
    uu[sz++] = v;
  }

  n = N;
  m = M;

  sort(uu, uu + sz);
  int u = unique(uu, uu + sz) - uu;

  for (int i = 0; i < n; i++) {
    a[i] = lower_bound(uu, uu + u, a[i]) - uu;
  }

  for (int i = 0; i < m; i++) {
    b[i] = lower_bound(uu, uu + u, b[i]) - uu;
  }

  // cerr << "a: ";
  // for (int i = 0; i < n; i++) {
  //   cout << a[i] << " ";
  // }
  // cout << "\n";

  // cerr << "b: ";
  // for (int i = 0; i < m; i++) {
  //   cout << b[i] << " ";
  // }
  // cout << "\n";

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

  for (int i = n - 1; i >= 0; i--) {
    for (int l = 0; l < u; 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 < u; 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 j = m - 1; j >= 0; j--) {
      for (int p = 0; p <= 1; p++) {
        dp[i][j][p] = false;
        for (int v = 0; v < u; v++) {
          int ip = nxta[i][v] + 1;
          int jp = nxtb[j][v] + 1;
          if (ip == n + 1 || jp == m + 1) {
            continue;
          }
          // cerr << "(" << i << ", " << j << ") => " << "(" << ip << ", " << jp
          //      << ")\n";
          dp[i][j][p] |= !dp[ip][jp][p ^ 1];
        }
      }
    }
  }

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