#include <bits/stdc++.h>
using namespace std;
const int Q = (1 << 20) + 1;
int las[Q], e[Q << 1], nn[Q << 1], inc = 1;
void ins(int x, int y) {
  e[++inc] = y;
  nn[inc] = las[x];
  las[x] = inc;
}
int dfn[Q], low[Q], Time = 0, bel[Q];
int sta[Q], tp = 0, inst[Q];
int X[Q][2], C[Q][2];
vector<int> cnt[Q], h[Q];
int mx[Q], scc = 0;
void dfs(int x, int lt, int ty) {
  low[x] = dfn[x] = ++Time;
  sta[++tp] = x, inst[x] = 1;
  for (int t = las[x]; t; t = nn[t]) {
    int y = e[t];
    if (e[t] == lt) continue;
    if (!dfn[y]) {
      dfs(y, t ^ 1, ty);
      low[x] = min(low[x], low[y]);
    } else if (inst[y])
      low[x] = min(low[x], dfn[y]);
  }
  if (low[x] != dfn[x]) return;
  int u;
  ++scc;
  do {
    u = sta[tp--];
    inst[u] = 0;
    bel[u] = scc;
    if (ty) cnt[scc].push_back(u);
  } while (u != x);
}
int L[Q], R[Q];
queue<int> q;
int in[Q];
struct dt {
  int tl, val;
} cmp[Q];
bool operator<(dt a, dt b) { return a.val < b.val; }
vector<int> ans;
int main() {
  int n, lim, m1, m2;
  scanf("%d%d%d%d", &m1, &n, &lim, &m2);
  for (int i = 1, x, y; i <= m1; i++)
    scanf("%d%d", &x, &y), X[i][0] = x, X[i][1] = y, ins(x << 1, (y << 1) - 1),
                           ins(y << 1, (x << 1) - 1);
  for (int i = 1; i <= n; i++) scanf("%d%d", &L[i], &R[i]);
  for (int i = 1, x, y; i <= m2; i++)
    scanf("%d%d", &x, &y), C[i][0] = x, C[i][1] = y, ins((x << 1) - 1, y << 1),
                           ins((y << 1) - 1, x << 1);
  for (int i = 1; i <= (n << 1); i++)
    if (!dfn[i]) dfs(i, 0, 1);
  for (int i = 1; i <= (n << 1); i++)
    if (dfn[(i << 1) - 1] == dfn[i << 1]) return 0 & puts("-1");
  for (int i = 1; i <= scc; i++)
    for (int x : cnt[i])
      for (int t = las[x]; t; t = nn[t]) {
        int j = bel[e[t]];
        if (i == j) continue;
        ++in[i];
        h[j].push_back(i);
      }
  for (int i = 1; i <= n; i++) {
    int p = (n << 1) + i;
    mx[bel[i]] = max(L[i], mx[bel[i]]);
  }
  for (int i = 1; i <= scc; i++)
    if (!in[i]) q.push(i);
  while (q.size()) {
    int x = q.front();
    q.pop();
    for (int y : h[x]) {
      mx[y] = max(mx[y], mx[x]), --in[y];
      if (!in[y]) q.push(y);
    }
  }
  for (int i = 1; i <= n; i++) cmp[i] = (dt){mx[i + n], R[i]};
  sort(cmp + 1, cmp + n + 1);
  for (int i = 1, pp = 1, mx = -1e9; i <= lim; i++) {
    while (pp <= n && cmp[pp].val < i) mx = max(mx, cmp[pp].tl), ++pp;
    if (i < mx) continue;
    int ct = 0;
    for (int j = 1; j <= n; j++)
      if (L[j] <= i && R[j] >= i)
        if (dfn[j] < dfn[j + n]) ans.push_back(j);
    printf("%d %d\n", ct, i);
    for (int p : ans) printf("%d ", p);
    puts("");
    return 0;
  }
  puts("-1");
  return 0;
}
