#include <bits/stdc++.h>
using namespace std;
const int maxn = 1600005;
const int maxm = 4000005;
int m0, n, m, m1, head[maxn], to[maxm], nxt[maxm], tot;
int low[maxn], dfn[maxn], col[maxn], sta[maxn], tim, color, top;
bool vis[maxn];
inline void addedge(int x, int y) {
  to[++tot] = y;
  nxt[tot] = head[x];
  head[x] = tot;
}
inline void add(int x, int y) { addedge(x, y), addedge(y ^ 1, x ^ 1); }
void tarjan(int u) {
  low[u] = dfn[u] = ++tim, vis[u] = 1, sta[++top] = u;
  for (int i = head[u]; i; i = nxt[i]) {
    int v = to[i];
    if (!dfn[v])
      tarjan(v), low[u] = min(low[u], low[v]);
    else if (vis[v])
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    color++;
    do col[sta[top]] = color, vis[sta[top]] = 0;
    while (sta[top--] != u);
  }
}
inline bool solve() {
  for (int i = 0; i <= ((n + m) << 1 | 1); i++)
    if (!dfn[i]) tarjan(i);
  for (int i = 0; i <= n + m; i++)
    if (col[((i) << 1)] == col[((i) << 1 | 1)]) return false;
  return true;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + ch - '0';
  return (f == 1) ? x : -x;
}
void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
int main() {
  m0 = read(), n = read(), m = read(), m1 = read();
  int x, y;
  for (int i = 0; i < m0; i++)
    x = read() - 1, y = read() - 1, add(((x) << 1 | 1), ((y) << 1));
  for (int i = 0; i < m; i++) add(((n + i) << 1), ((n + i + 1) << 1));
  add(((n) << 1), ((n) << 1 | 1));
  for (int i = 0; i < n; i++)
    x = read(), y = read(), add(((i) << 1), ((n + x - 1) << 1 | 1)),
    add(((i) << 1), ((n + y) << 1));
  for (int i = 0; i < m1; i++)
    x = read() - 1, y = read() - 1, add(((x) << 1), ((y) << 1 | 1));
  if (!solve()) return print(-1), putchar('\n'), 0;
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (col[((i) << 1)] < col[((i) << 1 | 1)]) ans++;
  for (int i = 1; i <= m; i++)
    if (col[((n + i) << 1)] < col[((n + i) << 1 | 1)]) {
      print(ans), putchar(' ');
      print(i), putchar('\n');
      break;
    }
  for (int i = 0; i < n; i++)
    if (col[((i) << 1)] < col[((i) << 1 | 1)]) print(i + 1), putchar(' ');
  putchar('\n');
  return 0;
}
