#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000005 * 2;
vector<int> G[MAXN];
int low[MAXN], dfn[MAXN], instack[MAXN], color[MAXN];
int dfscnt, scccnt;
stack<int> stk;
int yes(int u) { return u << 1; }
int no(int u) { return u << 1 | 1; }
void tarjan(int u) {
  low[u] = dfn[u] = ++dfscnt;
  stk.push(u);
  instack[u] = true;
  for (auto &v : G[u]) {
    if (dfn[v] == -1) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
    } else if (instack[v])
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    ++scccnt;
    do {
      color[u] = scccnt;
      u = stk.top();
      stk.pop();
      instack[u] = false;
    } while (low[u] != dfn[u]);
  }
}
int main() {
  int n, p, M, m;
  scanf("%d%d%d%d", &n, &p, &M, &m);
  for (int i = 1, x, y; i <= n; ++i) {
    scanf("%d%d", &x, &y);
    --x;
    --y;
    G[no(x)].push_back(yes(y));
    G[yes(y) ^ 1].push_back(no(x) ^ 1);
  }
  for (int i = 0; i < M; i++) {
    G[yes(p + i)].push_back(yes(p + i + 1));
    G[yes(p + i + 1) ^ 1].push_back(yes(p + i) ^ 1);
  }
  G[yes(p)].push_back(no(p));
  G[no(p) ^ 1].push_back(yes(p) ^ 1);
  for (int i = 0, l, r; i < p; i++) {
    scanf("%d%d", &l, &r);
    G[yes(i)].push_back(no(p + l - 1));
    G[no(p + l - 1) ^ 1].push_back(yes(i) ^ 1);
    G[yes(i)].push_back(yes(p + r));
    G[yes(p + r) ^ 1].push_back(yes(i) ^ 1);
  }
  for (int i = 0, x, y; i < m; i++) {
    scanf("%d%d", &x, &y);
    --x;
    --y;
    G[yes(x)].push_back(no(y));
    G[no(y) ^ 1].push_back(yes(x) ^ 1);
  }
  memset(dfn, -1, sizeof(dfn));
  for (int i = 0; i <= no(p + M); ++i)
    if (dfn[i] == -1) tarjan(i);
  for (int i = 0; i <= p + M; ++i)
    if (color[yes(i)] == color[no(i)]) {
      printf("-1\n");
      return 0;
    }
  int k = 0;
  for (int i = 0; i < p; i++)
    if (color[yes(i)] < color[no(i)]) k++;
  for (int i = 1; i <= M; i++) {
    if (color[yes(p + i)] < color[no(p + i)]) {
      printf("%d %d\n", k, i);
      break;
    }
  }
  for (int i = 0; i < p; i++)
    if (color[yes(i)] < color[no(i)]) printf("%d ", i + 1);
  return 0;
}
