#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int SUM = 0, ff = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    SUM = (SUM << 3) + (SUM << 1) + (ch ^ 48);
    ch = getchar();
  }
  return SUM * ff;
}
inline int yes(int x) { return x << 1; }
inline int no(int x) { return x << 1 | 1; }
const int N = 2000010;
struct edge {
  int nxt, to;
} e[N << 2];
int h[N], cnte = 1;
inline void addedge(int u, int v) { e[++cnte] = (edge){h[u], v}, h[u] = cnte; }
int n, m, p, q;
int dfn[N], low[N], Time;
int stk[N], tops;
int belong[N], scc;
bool ins[N];
inline void Tarjan(int u) {
  dfn[u] = low[u] = ++Time;
  stk[++tops] = u;
  ins[u] = 1;
  for (int i = h[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    if (!dfn[v]) {
      Tarjan(v);
      low[u] = min(low[u], low[v]);
    } else if (ins[v]) {
      low[u] = min(low[u], dfn[v]);
    }
  }
  if (low[u] == dfn[u]) {
    scc++;
    int y = 0;
    do {
      y = stk[tops--];
      belong[y] = scc;
      ins[y] = 0;
    } while (y != u);
  }
}
inline void build() {
  for (int i = 1; i <= q; i++) {
    int x = read(), y = read();
    addedge(no(x), yes(y));
    addedge(no(y), yes(x));
  }
  for (int i = 0; i <= m; i++) {
    addedge(yes(n + i + 1), yes(n + i + 2));
    addedge(no(n + i + 2), no(n + i + 1));
  }
  addedge(yes(n + 1), no(n + 1));
  for (int i = 1; i <= n; i++) {
    int l = read(), r = read();
    addedge(yes(i), no(n + l));
    addedge(yes(i), yes(n + r + 1));
    addedge(yes(n + l), no(i));
    addedge(no(n + r + 1), no(i));
  }
  for (int i = 1; i <= p; i++) {
    int x = read(), y = read();
    addedge(yes(x), no(y));
    addedge(yes(y), no(x));
  }
}
inline void solve() {
  for (int i = yes(1); i <= no(n + m + 2); i++)
    if (!dfn[i]) Tarjan(i);
  for (int i = 1; i <= n + m + 2; i++)
    if (belong[yes(i)] == belong[no(i)]) {
      puts("-1");
      return;
    }
  vector<int> radio;
  for (int i = 1; i <= n; i++)
    if (belong[yes(i)] < belong[no(i)]) radio.push_back(i);
  for (int i = 1; i <= m; i++) {
    if (belong[yes(n + i + 1)] < belong[no(n + i + 1)]) {
      printf("%d %d\n", radio.size(), i);
      break;
    }
  }
  for (auto x : radio) printf("%d ", x);
  puts("");
}
int main() {
  q = read(), n = read(), m = read(), p = read();
  build();
  solve();
  return 0;
}
