#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int w = 0, x = 0;
  char c = getchar();
  while (!isdigit(c)) w |= c == '-', c = getchar();
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  return w ? -x : x;
}
namespace star {
const int maxn = 1e6 + 10;
int ecnt, head[maxn << 2], nxt[maxn << 2], to[maxn << 2];
inline void addedge(int a, int b) {
  to[++ecnt] = b, nxt[ecnt] = head[a], head[a] = ecnt;
  to[++ecnt] = a ^ 1, nxt[ecnt] = head[b ^ 1], head[b ^ 1] = ecnt;
}
int n, m1, m2, k;
int dfn[maxn << 2], low[maxn << 2], tot, belong[maxn << 2], st[maxn << 2], top,
    _n;
bool vis[maxn << 2];
void tarjan(int x) {
  st[++top] = x;
  low[x] = dfn[x] = ++tot;
  vis[x] = 1;
  for (int i = head[x]; i; i = nxt[i]) {
    int u = to[i];
    if (dfn[u] == -1)
      tarjan(u), low[x] = min(low[x], low[u]);
    else if (vis[u])
      low[x] = min(low[x], dfn[u]);
  }
  if (dfn[x] == low[x]) {
    int now = -1;
    _n++;
    while (now ^ x) now = st[top--], vis[now] = 0, belong[now] = _n;
  }
}
inline bool solve() {
  memset(dfn, -1, sizeof dfn);
  for (int i = 0; i <= ((n + k) << 1 | 1); i++)
    if (dfn[i] == -1) tarjan(i);
  for (int i = 0; i <= n + k; i++)
    if (belong[((i) << 1)] == belong[((i) << 1 | 1)]) return 0;
  return 1;
}
inline void work() {
  m1 = read(), n = read(), k = read(), m2 = read();
  for (int i = 0; i < m1; i++) {
    int u = read() - 1, v = read() - 1;
    addedge(((u) << 1 | 1), ((v) << 1));
  }
  for (int i = 0; i < k; i++) addedge(((n + i) << 1), ((n + i + 1) << 1));
  addedge(((n) << 1), ((n) << 1 | 1));
  for (int i = 0; i < n; i++)
    addedge(((i) << 1), ((n + read() - 1) << 1 | 1)),
        addedge(((i) << 1), ((n + read()) << 1));
  for (int i = 0; i < m2; i++) {
    int u = read() - 1, v = read() - 1;
    addedge(((u) << 1), ((v) << 1 | 1));
  }
  if (!solve()) return (void)puts("-1");
  int ans = 0;
  for (int i = 0; i < n; i++)
    ans += belong[((i) << 1)] < belong[((i) << 1 | 1)];
  printf("%d ", ans);
  for (int i = 1; i <= k; i++)
    if (belong[((n + i) << 1)] < belong[((n + i) << 1 | 1)]) {
      printf("%d\n", i);
      break;
    }
  for (int i = 0; i < n; i++)
    if (belong[((i) << 1)] < belong[((i) << 1 | 1)]) printf("%d ", i + 1);
}
}  // namespace star
signed main() {
  star::work();
  return 0;
}
