#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x(0);
  register char c(getchar());
  while (c > '9' || c < '0') c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
  return x;
}
const int N = 4001000;
struct edge {
  int to, next;
} e[N];
int head[N], tot, HEAD[N];
int n, m, M, p;
int b[N], in[N], out[N], rootin, rootout, dian;
int cnt, turn[N], belong[N], vis[N];
void add(int x, int y) {
  e[++tot].to = y;
  e[tot].next = head[x];
  head[x] = tot;
  e[++tot].to = x;
  e[tot].next = HEAD[y];
  HEAD[y] = tot;
}
void dfs1(int u) {
  int i;
  vis[u] = 1;
  for (i = head[u]; i; i = e[i].next)
    if (!vis[e[i].to]) dfs1(e[i].to);
  turn[++cnt] = u;
}
void dfs2(int u) {
  belong[u] = cnt;
  vis[u] = 1;
  for (int i = HEAD[u]; i; i = e[i].next)
    if (!vis[e[i].to]) dfs2(e[i].to);
}
void kosaraju() {
  for (int i = 1; i <= dian; i++)
    if (!vis[i]) dfs1(i);
  memset((vis), 0, sizeof((vis)));
  cnt = 0;
  for (int i = dian; i >= 1; i--)
    if (!vis[turn[i]]) cnt++, dfs2(turn[i]);
}
struct node {
  int id, l, r;
} a[N];
bool cmp(node x, node y) { return x.l < y.l; }
int ans[N], anscnt, suf1[N], suf2[N];
int main() {
  register int i;
  n = read();
  m = read();
  M = read();
  p = read();
  dian = 2 * m;
  for (i = 1; i <= n; i++) {
    int x = read(), y = read();
    add(y + m, x);
    add(x + m, y);
  }
  for (i = 1; i <= m; i++) {
    a[i].id = i;
    a[i].l = read();
    a[i].r = read();
  }
  for (i = 1; i <= p; i++) {
    int x = read(), y = read();
    add(x, y + m);
    add(y, x + m);
  }
  sort(a + 1, a + 1 + m, cmp);
  for (i = 1; i <= m; i++) b[i] = a[i].l;
  for (i = m; i >= 1; i--) {
    suf1[i] = ++dian;
    add(a[i].id, suf1[i]);
    suf2[i] = ++dian;
    add(suf2[i], a[i].id);
    if (i != m) add(suf2[i], suf2[i - 1]), add(suf1[i - 1], suf1[i]);
  }
  for (i = 1; i <= m; i++) {
    int v = upper_bound(b + 1, b + 1 + m, a[i].r) - b;
    if (v <= m) {
      add(a[i].id, suf2[v]);
      add(suf1[v], 1);
    }
  }
  kosaraju();
  int L = 0, R = M;
  for (i = 1; i <= m; i++) {
    if (belong[a[i].id] != belong[a[i].id + m] &&
        belong[a[i].id] > belong[a[i].id + m]) {
      ans[++anscnt] = a[i].id;
      L = max(a[i].l, L);
      R = min(a[i].r, R);
    }
  }
  if (L > R || !anscnt) {
    cout << -1;
    return 0;
  } else {
    cout << anscnt << ' ' << L << '\n';
    for (i = 1; i <= anscnt; i++) cout << ans[i] << ' ';
  }
  return 0;
}
