#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e6 + 10;
long long N, P, M1, M2, _N, cnt, num, vis[MAXN], dfn[MAXN], low[MAXN],
    head[MAXN], bel[MAXN];
stack<long long> st;
struct edge {
  long long nt, to;
} E[MAXN << 1];
long long no(long long);
long long yes(long long);
bool calc();
void tarjan(long long);
void add(long long, long long);
int main() {
  memset(head, -1, sizeof(head));
  scanf("%lld%lld%lld%lld", &N, &P, &M1, &M2);
  for (long long i = 1, x, y; i <= N; i++) {
    scanf("%lld%lld", &x, &y);
    x--, y--;
    add(no(y), yes(x));
    add(no(x), yes(y));
  }
  for (long long i = 0; i < M1; i++) {
    add(yes(i + P), yes(i + P + 1));
    add(no(i + P + 1), no(i + P));
  }
  add(yes(P), no(P));
  for (long long l, r, i = 0; i < P; i++) {
    scanf("%lld%lld", &l, &r);
    add(yes(i), no(P + l - 1));
    add(yes(P + l - 1), no(i));
    add(yes(i), yes(P + r));
    add(no(P + r), no(i));
  }
  for (long long i = 1, x, y; i <= M2; i++) {
    scanf("%lld%lld", &x, &y);
    x--, y--;
    add(yes(x), no(y));
    add(yes(y), no(x));
  }
  if (calc()) {
    long long k = 0;
    for (long long i = 0; i < P; i++)
      if (bel[yes(i)] < bel[no(i)]) k++;
    for (long long i = 1; i <= M1; i++)
      if (bel[yes(i + P)] < bel[no(i + P)]) {
        printf("%lld %lld\n", k, i);
        break;
      }
    for (long long i = 0; i < P; i++)
      if (bel[yes(i)] < bel[no(i)]) printf("%lld ", i + 1);
  } else
    puts("-1");
  return 0;
}
long long no(long long x) { return x << 1 | 1; }
long long yes(long long x) { return x << 1; }
bool calc() {
  for (long long i = 0; i <= no(M1 + P); i++)
    if (!dfn[i]) tarjan(i);
  for (long long i = 0; i <= M1 + P; i++)
    if (bel[yes(i)] == bel[no(i)]) return false;
  return true;
}
void tarjan(long long n) {
  dfn[n] = low[n] = ++num;
  st.push(n);
  vis[n] = 1;
  for (long long i = head[n]; ~i; i = E[i].nt) {
    long long v = E[i].to;
    if (!dfn[v]) {
      tarjan(v);
      low[n] = min(low[v], low[n]);
    } else if (vis[v])
      low[n] = min(dfn[v], low[n]);
  }
  if (dfn[n] == low[n]) {
    _N++;
    long long t;
    do {
      t = st.top();
      st.pop();
      bel[t] = _N;
      vis[t] = 0;
    } while (t != n);
  }
}
void add(long long x, long long y) {
  cnt++;
  E[cnt].to = y;
  E[cnt].nt = head[x];
  head[x] = cnt;
}
