#include <bits/stdc++.h>
using namespace std;
const int N = 1600043;
vector<int> g[N];
vector<int> gt[N];
int used[N];
vector<int> order;
int comp[N];
vector<int> result;
int v;
void addEdge(int x, int y) {
  g[x].push_back(y);
  gt[y].push_back(x);
}
void addDisjunction(int x, int y) {
  addEdge(x ^ 1, y);
  addEdge(y ^ 1, x);
}
void dfs1(int x) {
  if (used[x]) return;
  used[x] = 1;
  for (auto y : g[x]) dfs1(y);
  order.push_back(x);
}
void dfs2(int x, int cc) {
  if (comp[x]) return;
  comp[x] = cc;
  for (auto y : gt[x]) dfs2(y, cc);
}
bool solve2SAT() {
  for (int i = 0; i < v * 2; i++) dfs1(i);
  reverse(order.begin(), order.end());
  int cc = 0;
  for (auto x : order) {
    if (comp[x] == 0) {
      cc++;
      dfs2(x, cc);
    }
  }
  for (int i = 0; i < v; i++) {
    if (comp[i * 2] == comp[i * 2 + 1])
      return false;
    else if (comp[i * 2] > comp[i * 2 + 1])
      result.push_back(i);
  }
  return true;
}
void solve() {
  int n, p, M, m;
  cin >> n >> p >> M >> m;
  v = p + M - 1;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    addDisjunction(x * 2, y * 2);
  }
  for (int i = 0; i < p; i++) {
    int l, r;
    cin >> l >> r;
    if (l != 1) addDisjunction((l - 2 + p) * 2, i * 2 + 1);
    if (r != M) addDisjunction((r - 1 + p) * 2 + 1, i * 2 + 1);
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    addDisjunction(x * 2 + 1, y * 2 + 1);
  }
  for (int i = 2; i <= M - 1; i++) {
    int f1 = i - 2 + p;
    int f2 = f1 + 1;
    addDisjunction(f1 * 2, f2 * 2 + 1);
  }
  if (!solve2SAT()) {
    cout << -1;
    return;
  }
  int k = 1;
  vector<int> stations;
  for (auto x : result)
    if (x < p)
      stations.push_back(x);
    else
      k = max(k, x - p + 2);
  cout << stations.size() << ' ' << k << '\n';
  for (auto x : stations) cout << x + 1 << ' ';
  return;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
}
