#include <bits/stdc++.h>
using namespace std;
struct twosat {
  int n;
  vector<vector<int>> adj, rev;
  twosat(int _n) : n(_n), adj(_n), rev(_n) {}
  void addedge(int x, int y) {
    adj[x].push_back(y);
    rev[y].push_back(x);
  }
  void addrel(int x, int y) {
    addedge(x ^ 1, y);
    addedge(y ^ 1, x);
  }
  int cnt;
  vector<int> comp;
  stack<int> st;
  void dfs(int u) {
    comp[u] = 1;
    for (auto& v : adj[u])
      if (!comp[v]) dfs(v);
    st.push(u);
  }
  void dfs2(int u) {
    comp[u] = cnt;
    for (auto& v : rev[u])
      if (!comp[v]) dfs2(v);
  }
  bool solve() {
    comp.assign(n, 0);
    for (int i = (0), _b = (n - 1); i <= _b; ++i)
      if (!comp[i]) dfs(i);
    fill(comp.begin(), comp.end(), 0);
    cnt = 0;
    while (((int)st.size())) {
      int u = st.top();
      st.pop();
      if (!comp[u]) ++cnt, dfs2(u);
    }
    for (int i = (0), _b = (n - 1), _z = (2); i <= _b; i += _z)
      if (comp[i] == comp[i ^ 1]) return 0;
    return 1;
  }
  vector<int> extract() {
    vector<int> ans;
    for (int i = (0), _b = (n - 1), _z = (2); i <= _b; i += _z)
      if (comp[i] > comp[i ^ 1]) ans.push_back(i >> 1);
    return ans;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, p, M, m;
  cin >> n >> p >> M >> m;
  twosat ts(p + M - 1 << 1);
  for (int i = (0), _b = (n - 1); i <= _b; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    ts.addrel(x << 1, y << 1);
  }
  for (int i = (0), _b = (p - 1); i <= _b; ++i) {
    int l, r;
    cin >> l >> r;
    if (l != 1) ts.addrel((l + p - 2) << 1, i << 1 | 1);
    if (r != M) ts.addrel((r + p - 1) << 1 | 1, i << 1 | 1);
  }
  for (int i = (0), _b = (m - 1); i <= _b; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    ts.addrel(x << 1 | 1, y << 1 | 1);
  }
  for (int i = (2), _b = (M - 1); i <= _b; ++i) {
    int x = i + p - 2, y = x + 1;
    ts.addrel(x << 1, y << 1 | 1);
  }
  if (!ts.solve()) return cout << -1, 0;
  vector<int> res;
  int k = 1;
  for (auto& x : ts.extract()) {
    if (x < p)
      res.push_back(x);
    else
      k = max(k, x - p + 2);
  }
  cout << ((int)res.size()) << ' ' << k << '\n';
  for (auto& x : res) cout << x + 1 << ' ';
  return 0;
}
