#include <bits/stdc++.h>
using namespace std;
int n, m, M, p, cnt, h[400008], ans[400008], Cmt;
struct node {
  int nxt, to;
} e[400008 << 2];
void add(int x, int y) {
  e[++cnt].nxt = h[x];
  e[cnt].to = y;
  h[x] = cnt;
}
int dfn[400008 << 1], low[400008 << 1], stac[400008 << 1], in[400008 << 1],
    head, id, cmt, k[400008 << 1];
void tarjan(int x) {
  low[x] = dfn[x] = ++id;
  stac[++head] = x;
  in[x] = 1;
  for (int i = h[x]; i; i = e[i].nxt) {
    int to = e[i].to;
    if (!dfn[to]) {
      tarjan(to);
      low[x] = min(low[to], low[x]);
    } else if (in[to])
      low[x] = min(low[x], dfn[to]);
  }
  if (low[x] == dfn[x]) {
    int y = stac[head--];
    in[x] = 0;
    k[x] = ++cmt;
    while (y != x) {
      in[y] = 0;
      k[y] = cmt;
      y = stac[head--];
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &p, &M, &m);
  int N = M + p + 1;
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y + N);
    add(x + N, y);
  }
  for (int i = 1; i <= p; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    add(i, l + p + N);
    add(i, r + 1 + p);
    add(l + p, i + N);
    add(r + 1 + p + N, i + N);
  }
  for (int i = 1; i <= M; i++) {
    add(i + p, i + 1 + p);
    add(i + 1 + p + N, i + p + N);
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y + N);
    add(x + N, y);
  }
  add(p + 1, p + 1 + N);
  for (int i = 1; i <= (N << 1); i++)
    if (!dfn[i]) tarjan(i);
  for (int i = 1; i <= N; i++)
    if (k[i] == k[i + p]) {
      cout << -1;
      return 0;
    }
  for (int i = 1; i <= p; i++)
    if (k[i] < k[i + N]) ans[++Cmt] = i;
  for (int i = 1; i <= M; i++)
    if (k[i] < k[i + N]) {
      cout << Cmt << " " << i << endl;
      break;
    }
  for (int i = 1; i <= Cmt; i++) cout << ans[i] << " ";
}
