#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 10;
vector<int> g[maxn], vecl[maxn], vecr[maxn];
int dfn[maxn], low[maxn], be[maxn], cnt, num;
int q[maxn], len;
bool vis[maxn];
void tarjan(int x) {
  dfn[x] = low[x] = ++cnt;
  q[++len] = x;
  vis[x] = 1;
  for (int i = 0; i < g[x].size(); i++) {
    int to = g[x][i];
    if (!dfn[to]) {
      tarjan(to);
      low[x] = min(low[x], low[to]);
    } else if (vis[to])
      low[x] = min(low[x], low[to]);
  }
  if (dfn[x] == low[x]) {
    int cur;
    num++;
    do {
      cur = q[len--];
      be[cur] = num;
      vis[cur] = 0;
    } while (x != cur);
  }
}
int n, p, M, m;
int ans[maxn], k, L[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> p >> M >> m;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    g[x + p].push_back(y);
    g[y + p].push_back(x);
  }
  for (int i = 1; i <= p; i++) {
    int r;
    cin >> L[i] >> r;
    vecl[L[i]].push_back(i);
    vecr[r].push_back(i);
  }
  int nd = 2 * p + 2, now1 = 2 * p + 1, now2 = 2 * p + 2;
  for (int i = 1; i <= M; i++) {
    for (int j = 0; j < vecl[i].size(); j++) {
      int tn = vecl[i][j];
      g[tn].push_back(now1);
      g[now2].push_back(tn + p);
    }
    for (int j = 0; j < vecr[i].size(); j++) {
      int tn = vecr[i][j];
      g[++nd].push_back(now1);
      g[nd].push_back(tn + p);
      now1 = nd;
      g[tn].push_back(++nd);
      g[now2].push_back(nd);
      now2 = nd;
    }
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y + p);
    g[y].push_back(x + p);
  }
  for (int i = 1; i <= 2 * p; i++)
    if (!dfn[i]) tarjan(i);
  int f = 1;
  for (int i = 1; i <= p; i++)
    if (low[i] == low[i + p]) f = 0;
  if (!f)
    cout << -1 << '\n';
  else {
    int l = 1;
    for (int i = 1; i <= p; i++)
      if (be[i] < be[i + p]) {
        ans[++*ans] = i;
        l = max(l, L[i]);
      }
    cout << ans[0] << ' ' << l << '\n';
    for (int i = 1; i <= *ans; i++) cout << ans[i] << ' ';
  }
  return 0;
}
