#include <bits/stdc++.h>
using namespace std;
struct ji {
  int nex, to;
} edge[1600005 << 2];
int E, n, m, m1, m2, x, y, ans, head[1600005], vis[1600005], dfn[1600005],
    low[1600005], s[1600005];
void add(int x, int y) {
  edge[E].nex = head[x];
  edge[E].to = y;
  head[x] = E++;
}
void dfs(int k) {
  dfn[k] = low[k] = ++x;
  s[++s[0]] = k;
  for (int i = head[k]; i != -1; i = edge[i].nex) {
    int v = edge[i].to;
    if (!dfn[v]) {
      dfs(v);
      low[k] = min(low[k], low[v]);
    } else if (!vis[v])
      low[k] = min(low[k], dfn[v]);
  }
  if (dfn[k] == low[k]) {
    vis[k] = ++vis[0];
    while (s[s[0]] != k) vis[s[s[0]--]] = vis[0];
    s[0]--;
  }
}
int main() {
  scanf("%d%d%d%d", &m1, &n, &m, &m2);
  memset(head, -1, sizeof(head));
  for (int i = 1; i <= m1; i++) {
    scanf("%d%d", &x, &y);
    add(2 * x - 1, 2 * y);
    add(2 * y - 1, 2 * x);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    add(2 * i, 2 * n + 2 * x);
    add(2 * n + 2 * x - 1, 2 * i - 1);
    if (y < m) {
      add(2 * i, 2 * n + 2 * y + 1);
      add(2 * n + 2 * y + 2, 2 * i - 1);
    }
  }
  for (int i = 1; i <= m2; i++) {
    scanf("%d%d", &x, &y);
    add(2 * x, 2 * y - 1);
    add(2 * y, 2 * x - 1);
  }
  for (int i = 1; i < m; i++) {
    add(2 * n + 2 * i + 2, 2 * n + 2 * i);
    add(2 * n + 2 * i - 1, 2 * n + 2 * i + 1);
  }
  x = 0;
  for (int i = 2; i <= 2 * (n + m); i += 2)
    if (!dfn[i]) dfs(i);
  for (int i = 1; i <= 2 * (n + m); i += 2)
    if (!dfn[i]) dfs(i);
  for (int i = 1; i <= n + m; i++)
    if (vis[2 * i - 1] == vis[2 * i]) {
      printf("-1");
      return 0;
    }
  for (int i = 1; i <= n; i++) ans += (vis[2 * i] < vis[2 * i - 1]);
  for (int i = m; i; i--)
    if (vis[2 * n + 2 * i] < vis[2 * n + 2 * i - 1]) {
      printf("%d %d\n", ans, i);
      for (int j = 1; j <= n; j++)
        if (vis[2 * j] < vis[2 * j - 1]) printf("%d ", j);
      return 0;
    }
}
