#include <bits/stdc++.h>
using namespace std;
int const N = 400000 + 10;
int const M = 1600000 + 10;
int h[M], cnt, bl[M], dfn[M], low[M], sum, n, p, t, s[M], top, vis[M], m;
struct edge {
  int to, nt;
} e[M << 2];
void add(int a, int b) {
  e[++cnt].to = b;
  e[cnt].nt = h[a];
  h[a] = cnt;
}
void dfs(int x) {
  dfn[x] = low[x] = ++cnt;
  s[++top] = x;
  for (int i = h[x]; i; i = e[i].nt) {
    int v = e[i].to;
    if (!dfn[v]) {
      dfs(v);
      low[x] = min(low[x], low[v]);
    } else if (!bl[v])
      low[x] = min(low[x], dfn[v]);
  }
  if (dfn[x] == low[x]) {
    sum++;
    while (s[top] != x) {
      bl[s[top]] = sum;
      top--;
    }
    bl[x] = sum;
    top--;
  }
}
int main() {
  scanf("%d%d%d%d", &n, &p, &m, &t);
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x << 1, y << 1 | 1);
    add(y << 1, x << 1 | 1);
  }
  for (int i = 1; i <= m; i++) {
    add((p + i) << 1 | 1, (p + i + 1) << 1 | 1);
    add((p + i + 1) << 1, (p + i) << 1);
  }
  for (int i = 1; i <= p; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add((p + x) << 1 | 1, i << 1);
    add(i << 1 | 1, (p + x) << 1);
    add((p + y + 1) << 1, i << 1);
    add(i << 1 | 1, (p + y + 1) << 1 | 1);
  }
  for (int i = 1; i <= t; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x << 1 | 1, y << 1);
    add(y << 1 | 1, x << 1);
  }
  cnt = 0;
  int ans = 0;
  for (int i = 2; i <= (p + m) * 2 + 3; i++)
    if (!bl[i]) dfs(i);
  int f = m;
  for (int i = 1; i <= p + m + 1; i++)
    if (bl[i << 1] == bl[i << 1 | 1]) {
      printf("-1\n");
      return 0;
    } else {
      vis[i] = bl[i << 1 | 1] < bl[i << 1];
      if (i <= p) ans += vis[i];
    }
  while (f > 0 && vis[p + f + 1]) f--;
  printf("%d %d\n", ans, f + 1);
  for (int i = 1; i <= p; i++)
    if (vis[i]) printf("%d ", i);
  return 0;
}
