#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6;
vector<int> g[MAXN], g1[MAXN];
int n, p, mp, m, all_n;
void add(int t1, int t2) {
  g[t1 ^ 1].push_back(t2);
  g1[t2].push_back(t1 ^ 1);
  g[t2 ^ 1].push_back(t1);
  g1[t1].push_back(t2 ^ 1);
}
vector<int> order;
bool vis[MAXN];
int comp[MAXN];
vector<int> res;
void dfs1(int u) {
  vis[u] = 1;
  for (auto v : g[u]) {
    if (vis[v] == 1) continue;
    dfs1(v);
  }
  order.push_back(u);
}
void dfs2(int u, int c) {
  comp[u] = c;
  for (auto v : g1[u]) {
    if (comp[v] == 0) dfs2(v, c);
  }
}
bool solveSAT() {
  for (int i = 0; i <= all_n * 2 - 3; i++) {
    if (vis[i] == 0) dfs1(i);
  }
  reverse(order.begin(), order.end());
  int cnt = 1;
  for (auto u : order) {
    if (comp[u] == 0) dfs2(u, cnt++);
  }
  for (int i = 0; i < all_n - 1; i++) {
    if (comp[2 * i] == comp[2 * i + 1]) {
      return 0;
    }
    if (comp[2 * i] > comp[2 * i + 1]) {
      res.push_back(i);
    }
  }
  return 1;
}
int main() {
  cin >> n >> p >> mp >> m;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    add(x * 2, y * 2);
  }
  all_n = mp + p;
  for (int i = 0; i < p; i++) {
    int l, r;
    cin >> l >> r;
    if (l != 1) {
      add((l + p - 2) * 2, i * 2 + 1);
    }
    if (r != mp) {
      add((r + p - 1) * 2 + 1, i * 2 + 1);
    }
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    add(x * 2 + 1, y * 2 + 1);
  }
  for (int i = 2; i < mp; i++) {
    add((i + p - 2) * 2, (i + p - 1) * 2 + 1);
  }
  if (!solveSAT()) {
    cout << "-1\n";
    return 0;
  }
  vector<int> st;
  int k = 1;
  for (auto t : res) {
    if (t < p) {
      st.push_back(t);
    } else {
      k = max(k, t - p + 2);
    }
  }
  cout << st.size() << " " << k << endl;
  for (int i = 0; i < st.size(); i++) cout << st[i] + 1 << " ";
  cout << endl;
  return 0;
}
