#include <bits/stdc++.h>
using namespace std;
const int N = 2000010;
int n, p, M, m, sum, deep, colour, v[N], dfn[N], low[N], color[N];
int ver[N << 1], Next[N << 1], head[N], tot;
stack<int> st;
inline int read() {
  int x = 0, tmp = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') tmp = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return tmp * x;
}
inline void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  int y = 10, len = 1;
  while (y <= x) {
    y = (y << 3) + (y << 1);
    len++;
  }
  while (len--) {
    y /= 10;
    putchar(x / y + 48);
    x %= y;
  }
}
inline void addEdge(int x, int y) {
  ver[++tot] = y;
  Next[tot] = head[x];
  head[x] = tot;
}
void tarjan(int x) {
  low[x] = dfn[x] = ++deep;
  v[x] = 1;
  st.push(x);
  for (int i = head[x]; i; i = Next[i]) {
    int y = ver[i];
    if (dfn[y] == -1) {
      tarjan(y);
      low[x] = min(low[x], low[y]);
    } else {
      if (v[y]) low[x] = min(low[x], dfn[y]);
    }
  }
  if (dfn[x] == low[x]) {
    color[x] = ++colour;
    v[x] = 0;
    while (st.top() != x) {
      color[st.top()] = colour;
      v[st.top()] = 0;
      st.pop();
    }
    st.pop();
  }
}
inline int yes(int p) { return p << 1; }
inline int no(int p) { return p << 1 | 1; }
int main() {
  n = read();
  p = read();
  M = read();
  m = read();
  for (int i = 1; i <= n; i++) {
    int x = read() - 1, y = read() - 1;
    addEdge(no(x), yes(y));
    addEdge(yes(y) ^ 1, no(x) ^ 1);
  }
  for (int i = 0; i < M; i++) {
    addEdge(yes(p + i), yes(p + i + 1));
    addEdge(yes(p + i + 1) ^ 1, yes(p + i) ^ 1);
  }
  addEdge(yes(p), no(p));
  addEdge(no(p) ^ 1, yes(p) ^ 1);
  for (int i = 0; i < p; i++) {
    int l = read(), r = read();
    addEdge(yes(i), no(p + l - 1));
    addEdge(no(p + l - 1) ^ 1, yes(i) ^ 1);
    addEdge(yes(i), yes(p + r));
    addEdge(yes(p + r) ^ 1, yes(i) ^ 1);
  }
  for (int i = 0; i < m; i++) {
    int x = read() - 1, y = read() - 1;
    addEdge(yes(x), no(y));
    addEdge(no(y) ^ 1, yes(x) ^ 1);
  }
  memset(dfn, -1, sizeof(dfn));
  for (int i = 0; i <= no(p + M); i++) {
    if (dfn[i] == -1) tarjan(i);
  }
  for (int i = 0; i <= p + M; i++) {
    if (color[yes(i)] == color[no(i)]) return printf("-1") & 0;
  }
  for (int i = 0; i < p; ++i) {
    if (color[yes(i)] < color[no(i)]) ++sum;
  }
  for (int i = 1; i <= M; ++i) {
    if (color[yes(p + i)] < color[no(p + i)]) {
      write(sum);
      putchar(' ');
      write(i);
      putchar('\n');
      break;
    }
  }
  for (int i = 0; i < p; ++i) {
    if (color[yes(i)] < color[no(i)]) {
      write(i + 1);
      putchar(' ');
    }
  }
  return 0;
}
