#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const int N = 1e6 + 7;
int n, m, p, q, L[N], R[N];
vector<int> Tl[N], Tr[N];
int fir[N], from[N << 1], to[N << 1], cntt;
inline void add(int a, int b) {
  from[++cntt] = fir[a];
  fir[a] = cntt;
  to[cntt] = b;
}
int dfn[N], low[N], dfs_clock, bel[N], tot, st[N], Top;
void Tarjan(int x) {
  dfn[x] = low[x] = ++dfs_clock;
  st[++Top] = x;
  for (int i = fir[x]; i; i = from[i]) {
    int &v = to[i];
    if (!dfn[v])
      Tarjan(v), low[x] = min(low[x], low[v]);
    else if (!bel[v])
      low[x] = min(low[x], dfn[v]);
  }
  if (low[x] == dfn[x]) {
    tot++;
    while (st[Top] != x) bel[st[Top--]] = tot;
    bel[st[Top--]] = tot;
  }
}
int main() {
  n = read(), m = read(), p = read(), q = read();
  int a, b;
  for (int i = 1; i <= n; i++) {
    a = read(), b = read();
    add(m + a, b);
    add(m + b, a);
  }
  for (int i = 1; i <= m; i++) {
    L[i] = read(), R[i] = read();
    Tl[L[i]].push_back(i);
    Tr[R[i] + 1].push_back(i);
  }
  for (int i = 1; i <= q; i++) {
    a = read(), b = read();
    add(a, m + b);
    add(b, m + a);
  }
  int cnt = m * 2, ta = ++cnt, tb = ++cnt;
  for (int i = 1; i <= p; i++) {
    for (auto x : Tl[i]) add(x, ta), add(tb, m + x);
    for (auto x : Tr[i]) {
      cnt++;
      add(cnt, m + x);
      add(ta, cnt);
      ta = cnt;
      cnt++;
      add(x, cnt);
      add(cnt, tb);
      tb = cnt;
    }
  }
  for (int i = 1; i <= 2 * m; i++)
    if (!dfn[i]) Tarjan(i);
  for (int i = 1; i <= m; i++)
    if (bel[i] == bel[m + i]) {
      printf("-1\n");
      return 0;
    }
  int ans = 0;
  vector<int> V;
  for (int i = 1; i <= m; i++)
    if (bel[i] < bel[i + m]) ans = max(ans, R[i]), V.push_back(i);
  printf("%d %d\n", int(V.size()), ans);
  for (auto x : V) printf("%d ", x);
  printf("\n");
  return 0;
}
