#include <bits/stdc++.h>
using namespace std;
int head[2000010], to[2000010 << 1], nxt[2000010 << 1], idx, sta[2000010], top,
    cnt, dep[2000010], low[2000010], bel[2000010], many, ans[2000010], n, all,
    p, M, m;
bool vis[2000010], in[2000010];
void add(int a, int b) { nxt[++idx] = head[a], to[idx] = b, head[a] = idx; }
void tarjan(int p) {
  dep[p] = low[p] = ++cnt, sta[++top] = p, vis[p] = in[p] = true;
  for (int i = head[p]; i; i = nxt[i])
    if (!vis[to[i]])
      tarjan(to[i]), low[p] = min(low[p], low[to[i]]);
    else if (in[to[i]])
      low[p] = min(low[p], dep[to[i]]);
  if (dep[p] == low[p]) {
    ++many;
    while (sta[top + 1] != p) bel[sta[top]] = many, in[sta[top]] = false, top--;
  }
}
int main() {
  scanf("%d%d%d%d", &all, &p, &M, &m), n = p + M;
  for (int i = 1, x, y; i <= all; i++)
    scanf("%d%d", &x, &y), add(x + n, y), add(y + n, x);
  for (int i = 1, l, r; i <= p; i++) {
    scanf("%d%d", &l, &r), add(i, l + p), add(l + n + p, i + n);
    if (r + 1 <= M) add(i, r + 1 + n + p), add(r + 1 + p, i + n);
  }
  for (int i = 1, x, y; i <= m; i++)
    scanf("%d%d", &x, &y), add(x, y + n), add(y, x + n);
  for (int i = 2; i <= M; i++)
    add(i + p, i - 1 + p), add(i + p - 1 + n, i + p + n);
  for (int i = 1; i <= 2 * n; i++)
    if (!vis[i]) tarjan(i);
  for (int i = 1; i <= n; i++)
    if (bel[i] == bel[i + n]) printf("-1\n"), exit(0);
  for (int i = 1; i <= p; i++)
    if (bel[i] < bel[i + n]) ans[++ans[0]] = i;
  for (int i = M; i; i--)
    if (bel[i + p] < bel[i + p + n]) {
      ans[++ans[0]] = i;
      break;
    }
  printf("%d %d\n", ans[0] - 1, ans[ans[0]]);
  for (int i = 1; i < ans[0]; i++) printf("%d ", ans[i]);
}
