#include <bits/stdc++.h>
using namespace std;
namespace IO {
const int BS = (1 << 23) + 5;
int Top = 0;
char Buffer[BS], OT[BS], *OS = OT, *HD, *TL, SS[20];
const char *fin = OT + BS - 1;
char Getchar() {
  if (HD == TL) {
    TL = (HD = Buffer) + fread(Buffer, 1, BS, stdin);
  }
  return (HD == TL) ? EOF : *HD++;
}
void flush() { fwrite(OT, 1, OS - OT, stdout), OS = OT; }
void Putchar(char c) {
  *OS++ = c;
  if (OS == fin) flush();
}
void write(int x) {
  if (!x) {
    Putchar('0');
    return;
  }
  if (x < 0) x = -x, Putchar('-');
  while (x) SS[++Top] = x % 10, x /= 10;
  while (Top) Putchar(SS[Top] + '0'), --Top;
}
inline long long read() {
  long long nm = 0;
  bool fh = true;
  char cw = getchar();
  for (; !isdigit(cw); cw = getchar()) fh ^= (cw == '-');
  for (; isdigit(cw); cw = getchar()) nm = nm * 10 + (cw - '0');
  return fh ? nm : -nm;
}
}  // namespace IO
using namespace IO;
int n, m, fs[402020 << 4], nt[402020 << 4], to[402020 << 4], tmp, cnt, cpl, lim,
    unq, tot, tim;
int pre[402020], suf[402020], L[402020], R[402020], be[402020 << 2],
    dfn[402020 << 2], low[402020 << 2], S[402020 << 2], top;
inline void link(int x, int y) { nt[tmp] = fs[x], fs[x] = tmp, to[tmp++] = y; }
inline void tarjan(int x) {
  ++tim, dfn[x] = low[x] = tim, S[++top] = x;
  for (int i = fs[x]; i != -1; i = nt[i]) {
    if (!dfn[to[i]]) tarjan(to[i]);
    if (!be[to[i]]) low[x] = min(low[x], low[to[i]]);
  }
  if (low[x] < dfn[x]) return;
  ++tot;
  while (!be[x]) be[S[top]] = tot, --top;
}
int main() {
  cpl = read(), n = read(), lim = read(), unq = read(), cnt = n + n;
  memset(fs, -1, sizeof(fs));
  for (int i = 1; i <= lim; i++) pre[i] = ++cnt, suf[i] = ++cnt;
  for (int i = 1; i < lim; i++)
    link(pre[i + 1], pre[i]), link(suf[i], suf[i + 1]);
  while (cpl--) {
    int x = read(), y = read();
    link(x + n, y), link(y + n, x);
  }
  for (int i = 1; i <= n; i++) {
    L[i] = read(), R[i] = read();
    if (L[i] > 1) link(i, pre[L[i] - 1]);
    if (R[i] < lim) link(i, suf[R[i] + 1]);
    link(pre[R[i]], i + n);
    link(suf[L[i]], i + n);
  }
  while (unq--) {
    int x = read(), y = read();
    link(x, y + n), link(y, x + n);
  }
  for (int i = 1; i <= cnt; i++)
    if (!dfn[i]) tarjan(i);
  int ans = top = 0;
  for (int i = 1; i <= n; i++)
    if (be[i] == be[i + n]) {
      puts("-1");
      return 0;
    }
  for (int i = 1; i <= n; i++)
    if (be[i] < be[i + n]) ans = max(ans, L[i]), S[++top] = i;
  printf("%d %d\n", top, ans);
  for (int i = 1; i <= top; i++) printf("%d%c", S[i], i < top ? ' ' : '\n');
  return 0;
}
