#include <bits/stdc++.h>
using namespace std;
const int N = 400010 << 2;
vector<int> G[N];
int dfn[N], low[N], dfncnt, s[N], tp, scc[N], sc, sz[N];
void tarjan(int u) {
  low[u] = dfn[u] = ++dfncnt, s[++tp] = u;
  for (int v : G[u]) {
    if (!dfn[v])
      tarjan(v), low[u] = min(low[u], low[v]);
    else if (!scc[v])
      low[u] = min(low[u], dfn[v]);
  }
  if (dfn[u] == low[u]) {
    ++sc;
    while (s[tp] != u) scc[s[tp]] = sc, ++sz[sc], --tp;
    scc[s[tp]] = sc, ++sz[sc], --tp;
  }
}
int a[N];
void init() {}
void add(int u, int v) { G[u].push_back(v); }
bool work(int n) {
  for (int i = (2); i <= (n << 1 | 1); ++i)
    if (!dfn[i]) tarjan(i);
  for (int i = (1); i <= (n); ++i)
    if (scc[i << 1] == scc[i << 1 | 1]) return 0;
  for (int i = (1); i <= (n); ++i) a[i] = (scc[i << 1] < scc[i << 1 | 1]);
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, p, M, m, x, y, l, r;
  cin >> n >> p >> M >> m;
  for (int i = (1); i <= (n); ++i) {
    cin >> x >> y;
    add(x << 1 | 1, y << 1);
    add(y << 1 | 1, x << 1);
  }
  for (int i = (1); i <= (p); ++i) {
    cin >> l >> r;
    if (l != 1) {
      add((l + p) << 1 | 1, i << 1 | 1);
      add(i << 1, (l + p) << 1);
    }
    if (r != M) {
      add((r + 1 + p) << 1, i << 1 | 1);
      add(i << 1, (r + 1 + p) << 1 | 1);
    }
  }
  for (int i = (2); i <= (M); ++i) {
    add((i + p) << 1, (i - 1 + p) << 1);
  }
  for (int i = (1); i <= (M - 1); ++i) {
    add((i + p) << 1 | 1, (i + 1 + p) << 1 | 1);
  }
  for (int i = (1); i <= (m); ++i) {
    cin >> x >> y;
    add(x << 1, y << 1 | 1);
    add(y << 1, x << 1 | 1);
  }
  if (work(M + p)) {
    int f = 1;
    vector<int> V;
    for (int i = (p + 1); i <= (p + M); ++i)
      if (a[i]) f = i - p;
    for (int i = (1); i <= (p); ++i)
      if (a[i]) V.push_back(i);
    cout << V.size() << " " << f << '\n';
    for (int v : V) cout << v << " ";
    cout << '\n';
  } else {
    cout << "-1\n";
  }
}
