#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
struct twosat {
  int size;
  vector<vector<int>> adj;
  vector<bool> on, out;
  vector<int> low, depth, stack, comp;
  int index, cur;
  twosat(int s) : size(s), adj(2 * s), out(s, 0) {}
  bool connect(int i) {
    low[i] = depth[i] = ++index;
    stack.push_back(i);
    on[i] = 1;
    for (int j : adj[i]) {
      if (depth[j] == -1) {
        connect(j);
        low[i] = min(low[i], low[j]);
      } else if (on[j])
        low[i] = min(low[i], depth[j]);
    }
    if (low[i] == depth[i]) {
      int j = -1;
      while (i != j) {
        j = stack.back();
        stack.pop_back();
        int k = (j + size) % (2 * size);
        if (comp[k] == cur) return true;
        if (comp[j] == -1 && comp[k] == -1) out[j % size] = j >= size;
        comp[j] = cur;
      }
      cur++;
    }
    return false;
  }
  vector<bool> solve() {
    depth.assign(2 * size, -1);
    low.assign(2 * size, -1);
    comp.assign(2 * size, -1);
    on.assign(2 * size, 0);
    stack.clear();
    index = cur = 0;
    for (int i = 0; i < 2 * size; i++)
      if (depth[i] == -1 && connect(i)) return {};
    return out;
  }
  inline void implies(int x, bool a, int y, bool b) {
    adj[x + (a ? size : 0)].push_back(y + (b ? size : 0));
    adj[y + (b ? 0 : size)].push_back(x + (a ? 0 : size));
  }
  inline void set(int x, bool a) {
    adj[x + (a ? 0 : size)].push_back(x + (a ? size : 0));
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, p, M, m;
  cin >> n >> p >> M >> m;
  twosat ts(p + M + 5);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    ts.implies(x, 0, y, 1);
  }
  for (int i = 1; i < M; i++) ts.implies(p + i + 1, 1, p + i, 1);
  for (int i = 0; i < p; i++) {
    int l, r;
    cin >> l >> r;
    ts.implies(i, 1, p + l, 1);
    ts.implies(i, 1, p + r + 1, 0);
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    ts.implies(x, 1, y, 0);
  }
  auto v = ts.solve();
  if (v.empty())
    cout << "-1\n";
  else {
    vector<int> ans;
    int f;
    for (int i = 1; i <= M; i++)
      if (v[p + i] && (i == M || !v[p + i + 1])) f = i;
    for (int i = 0; i < p; i++)
      if (v[i]) ans.push_back(i);
    cout << ans.size() << " " << f << "\n";
    for (int i = 0; i < ans.size(); i++)
      cout << ans[i] + 1 << " \n"[i + 1 == ans.size()];
  }
}
