#include <bits/stdc++.h>
int fr[1600010], ne[4000010], v[4000010], bs = 0;
void addb(int a, int b) {
  v[bs] = b;
  ne[bs] = fr[a];
  fr[a] = bs++;
}
int dfn[1600010], low[1600010], tm = 0, scc[1600010], ss = 0, st[1600010],
                                tp = 0;
void tarjan(int u) {
  dfn[u] = low[u] = ++tm;
  st[tp++] = u;
  for (int i = fr[u]; i != -1; i = ne[i]) {
    int t = v[i];
    if (!dfn[t]) {
      tarjan(t);
      low[u] = low[u] < low[t] ? low[u] : low[t];
    } else if (!scc[t])
      low[u] = low[u] < dfn[t] ? low[u] : dfn[t];
  }
  if (dfn[u] == low[u]) {
    ss += 1;
    while (1) {
      scc[st[tp - 1]] = ss;
      tp -= 1;
      if (st[tp] == u) break;
    }
  }
}
bool ch[400010];
int main() {
  int n, p, M, m, N, k = 0;
  scanf("%d%d%d%d", &n, &p, &M, &m);
  N = (p + M) * 2;
  for (int i = 1; i <= N; i++) fr[i] = -1;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    addb(x * 2, y * 2 - 1);
    addb(y * 2, x * 2 - 1);
  }
  for (int i = 2; i <= M; i++) addb(i * 2 + p * 2, (i - 1) * 2 + p * 2);
  for (int i = 1; i < M; i++) addb(i * 2 - 1 + p * 2, (i + 1) * 2 - 1 + p * 2);
  for (int i = 1; i <= p; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    r += 1;
    addb(i * 2 - 1, l * 2 + p * 2);
    addb(l * 2 - 1 + p * 2, i * 2);
    if (r <= M) {
      addb(i * 2 - 1, r * 2 - 1 + p * 2);
      addb(r * 2 + p * 2, i * 2);
    }
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    addb(x * 2 - 1, y * 2);
    addb(y * 2 - 1, x * 2);
  }
  for (int i = 1; i <= N; i++) {
    if (!dfn[i]) tarjan(i);
  }
  bool fi = false;
  for (int i = 1; i <= p; i++) {
    if (scc[i * 2] > scc[i * 2 - 1])
      ch[i] = true, k += 1;
    else if (scc[i * 2] < scc[i * 2 - 1])
      ch[i] = false;
    else
      fi = true;
  }
  int f = 1;
  for (int i = 1; i <= M; i++) {
    if (scc[i * 2 + p * 2] < scc[i * 2 - 1 + p * 2])
      f = i;
    else if (scc[i * 2 + p * 2] == scc[i * 2 - 1 + p * 2])
      fi = true;
  }
  if (fi)
    printf("-1");
  else {
    printf("%d %d\n", k, f);
    for (int i = 1; i <= p; i++) {
      if (ch[i]) printf("%d ", i);
    }
  }
  return 0;
}
