#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c *x) -> decltype(std::cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug &operator<<(const c &) {
    return *this;
  }
};
const int mod1 = 1e5 + 7;
const int mod2 = 1e9 + 7;
const long long mod3 = 1e12 + 7;
const int si = 4e5 + 7;
int n, m, M, p, choose[2][2 * si], x, y, ans[si], cnt, ans_cnt;
vector<int> son[4 * si];
int belong[4 * si], tin[4 * si], low[4 * si], now_time, scc_cnt;
stack<int> s;
void dfs(int o) {
  tin[o] = low[o] = ++now_time;
  s.push(o);
  for (auto v : son[o]) {
    if (!tin[v]) dfs(v);
    if (!belong[v]) low[o] = min(low[o], low[v]);
  }
  if (tin[o] == low[o]) {
    scc_cnt++;
    int now;
    while (true) {
      now = s.top();
      s.pop();
      belong[now] = scc_cnt;
      if (now == o) break;
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &p, &M, &m);
  for (int i = 1; i <= p; i++) {
    choose[0][i] = ++cnt;
    choose[1][i] = ++cnt;
  }
  for (int i = 0; i <= M; i++) {
    choose[0][1 + i + p] = ++cnt;
    choose[1][1 + i + p] = ++cnt;
  }
  son[choose[1][p + 1]].push_back(choose[0][p + 1]);
  son[choose[0][p + M + 1]].push_back(choose[1][p + M + 1]);
  for (int i = 1; i <= M; i++) {
    x = i + 1 + p;
    son[choose[0][x]].push_back(choose[0][x - 1]);
    son[choose[1][x - 1]].push_back(choose[1][x]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    son[choose[0][x]].push_back(choose[1][y]);
    son[choose[0][y]].push_back(choose[1][x]);
  }
  int li, ri;
  for (int i = 1; i <= p; i++) {
    scanf("%d%d", &x, &y);
    if (x > M) continue;
    li = x + p;
    ri = min(y, M) + p + 1;
    son[choose[1][i]].push_back(choose[0][li]);
    son[choose[1][li]].push_back(choose[0][i]);
    son[choose[0][ri]].push_back(choose[0][i]);
    son[choose[1][i]].push_back(choose[1][ri]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    son[choose[1][x]].push_back(choose[0][y]);
    son[choose[1][y]].push_back(choose[0][x]);
  }
  for (int i = 2; i <= cnt; i += 2)
    if (!tin[i]) dfs(i);
  for (int i = 1; i <= cnt; i += 2)
    if (!tin[i]) dfs(i);
  for (int i = 1; i <= 1 + p + M; i++)
    if (belong[choose[0][i]] == belong[choose[1][i]]) {
      printf("-1\n");
      return 0;
    }
  for (int i = 1; i <= p; i++) {
    if (belong[choose[1][i]] < belong[choose[0][i]]) ans[++ans_cnt] = i;
  }
  for (int i = 1; i <= M; i++) {
    if (belong[choose[1][1 + i + p]] < belong[choose[0][1 + i + p]]) {
      printf("%d %d\n", ans_cnt, i);
      for (int j = 1; j <= ans_cnt; j++) printf("%d ", ans[j]);
      break;
    }
  }
  return 0;
}
