#include <bits/stdc++.h>
using namespace std;
const int N = 2000005;
int zz[N << 1], ne[N << 1], fi[N], dfn[N], low[N], st[N], tot, cnt, ccol,
    col[N], vis[N], n, x, y, ccnt, M, p, m, l, r;
inline int yes(int x) { return x * 2; }
inline int no(int x) { return x * 2 + 1; }
inline void jb(int x, int y) {
  zz[++tot] = y;
  ne[tot] = fi[x];
  fi[x] = tot;
}
inline void add(int x, int y) {
  jb(x, y);
  jb(y ^ 1, x ^ 1);
}
void tarjan(int x) {
  dfn[x] = low[x] = ++cnt;
  st[++tot] = x, vis[x] = 1;
  for (int i = fi[x]; i; i = ne[i]) {
    int u = zz[i];
    if (!dfn[u]) {
      tarjan(u);
      low[x] = min(low[x], low[u]);
    } else if (vis[u])
      low[x] = min(low[x], dfn[u]);
  }
  if (dfn[x] == low[x]) {
    ccnt++;
    int u;
    do {
      u = st[tot--];
      col[u] = ccnt;
      vis[u] = 0;
    } while (u != x);
  }
}
int solve() {
  for (int i = yes(1); i <= no(n + 1 + M); i++)
    if (!dfn[i]) tarjan(i);
  for (int i = 1; i <= n + M + 1; i++)
    if (col[yes(i)] == col[no(i)]) return 0;
  return 1;
}
int main() {
  scanf("%d%d%d%d", &p, &n, &M, &m);
  for (int i = 1; i <= p; i++) {
    scanf("%d%d", &x, &y);
    add(no(x), yes(y));
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l, &r);
    add(yes(i), no(n + 1 + l - 1));
    add(yes(i), yes(n + 1 + r));
  }
  for (int i = 0; i < M; i++) add(yes(n + 1 + i), yes(n + 1 + i + 1));
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    add(yes(x), no(y));
  }
  add(yes(n + 1), no(n + 1));
  tot = 0;
  if (solve()) {
    cnt = 0;
    for (int i = 1; i <= n; i++)
      if (col[yes(i)] < col[no(i)]) cnt++;
    for (int i = 1; i <= M; i++)
      if (col[yes(n + 1 + i)] < col[no(n + 1 + i)]) {
        printf("%d %d\n", cnt, i);
        break;
      }
    for (int i = 1; i <= n; i++)
      if (col[yes(i)] < col[no(i)]) printf("%d ", i);
  } else
    puts("-1");
}
