#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16000000")
using namespace std;
const int Maxn = 1000005;
int n, p, M, m;
vector<int> neigh[Maxn];
int lef[Maxn], rig[Maxn];
int cur, tim[Maxn], low[Maxn];
vector<int> S;
bool onStack[Maxn];
int incomp[Maxn];
int numcomp;
int L[Maxn], R[Maxn];
int delt[Maxn];
vector<int> ans;
int Not(int v) { return v <= p ? p + v : v - p; }
void Connect(int v) {
  tim[v] = low[v] = ++cur;
  S.push_back(v);
  onStack[v] = true;
  for (int i = 0; i < neigh[v].size(); i++) {
    int u = neigh[v][i];
    if (!tim[u]) {
      Connect(u);
      low[v] = min(low[v], low[u]);
    } else if (onStack[u])
      low[v] = min(low[v], tim[u]);
  }
  if (low[v] == tim[v]) {
    numcomp++;
    L[numcomp] = 1;
    R[numcomp] = M;
    int u;
    do {
      u = S.back();
      S.pop_back();
      onStack[u] = false;
      if (u <= p) {
        L[numcomp] = max(L[numcomp], lef[u]);
        R[numcomp] = min(R[numcomp], rig[u]);
      }
      incomp[u] = numcomp;
      for (int i = 0; i < neigh[u].size(); i++) {
        int w = neigh[u][i];
        if (incomp[w] && incomp[w] < numcomp) {
          L[numcomp] = max(L[numcomp], L[incomp[w]]);
          R[numcomp] = min(R[numcomp], R[incomp[w]]);
        }
      }
    } while (u != v);
  }
}
int main() {
  scanf("%d %d %d %d", &n, &p, &M, &m);
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    neigh[Not(x)].push_back(y);
    neigh[Not(y)].push_back(x);
  }
  for (int i = 1; i <= p; i++) scanf("%d %d", &lef[i], &rig[i]);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    neigh[u].push_back(Not(v));
    neigh[v].push_back(Not(u));
  }
  for (int i = 1; i <= 2 * p; i++)
    if (!tim[i]) Connect(i);
  for (int i = 1; i <= p; i++)
    if (incomp[i] == incomp[Not(i)]) {
      printf("-1\n");
      return 0;
    }
  for (int i = 1; i <= p; i++) {
    int a = incomp[i], b = incomp[Not(i)];
    vector<pair<int, int> > seq;
    if (L[a] <= R[a]) seq.push_back(pair<int, int>(L[a], R[a]));
    if (L[b] <= R[b]) seq.push_back(pair<int, int>(L[b], R[b]));
    sort(seq.begin(), seq.end());
    if (seq.size() >= 1) {
      delt[seq[0].first]++;
      delt[seq[0].second + 1]--;
    }
    if (seq.size() >= 2 && seq.back().second > seq[0].second) {
      int fir = max(seq[0].second + 1, seq[1].first);
      delt[fir]++;
      delt[seq.back().second + 1]--;
    }
  }
  int st = 0;
  int bi = -1;
  for (int i = 1; i <= M; i++) {
    st += delt[i];
    if (st == p) {
      bi = i;
      break;
    }
  }
  if (bi == -1) {
    printf("-1\n");
    return 0;
  }
  for (int i = 1; i <= p; i++)
    if (L[incomp[Not(i)]] <= bi && bi <= R[incomp[Not(i)]])
      ;
    else
      ans.push_back(i);
  printf("%d %d\n", int(ans.size()), bi);
  for (int i = 0; i < ans.size(); i++)
    printf("%d%c", ans[i], i + 1 < ans.size() ? ' ' : '\n');
  return 0;
}
