#include <bits/stdc++.h>
using namespace std;
const int N = 17e5;
vector<int> edges[N], redges[N];
vector<int> top;
int used[N];
void addEdge(int v, int u) {
  edges[v].push_back(u);
  redges[u].push_back(v);
}
void addDisjunction(int v, int u) {
  addEdge(v ^ 1, u);
  addEdge(u ^ 1, v);
}
void dfs(int v) {
  used[v] = 1;
  for (int u : edges[v])
    if (!used[u]) dfs(u);
  top.push_back(v);
}
void dfsReverse(int v, int c) {
  used[v] = c;
  for (int u : redges[v]) {
    if (!used[u]) dfsReverse(u, c);
  }
}
void solve() {
  int n, p, M, m;
  cin >> n >> p >> M >> m;
  for (int i = 0; i < n; i++) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    addDisjunction(v * 2 + 1, u * 2 + 1);
  }
  for (int i = 0; i < p; i++) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    addDisjunction((p + l) * 2 + 1, i * 2);
    if (r != M - 1) addDisjunction((p + r + 1) * 2, i * 2);
  }
  for (int i = 0; i < m; i++) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    addDisjunction(v * 2, u * 2);
  }
  for (int i = 1; i <= M - 1; i++) {
    int f1 = p + i - 1;
    int f2 = f1 + 1;
    addDisjunction(f1 * 2 + 1, f2 * 2);
  }
  int cntNodes = 2 * p + 2 * M;
  for (int i = 0; i < cntNodes; i++) {
    if (!used[i]) dfs(i);
  }
  memset(used, 0, sizeof used);
  reverse(top.begin(), top.end());
  int clr = 1;
  for (int i = 0; i < cntNodes; i++) {
    if (!used[top[i]]) dfsReverse(top[i], clr++);
  }
  for (int i = 0; i < cntNodes; i++) {
    if (used[i] == used[i ^ 1]) {
      cout << -1;
      return;
    }
  }
  vector<int> radiostations;
  int funcValue = 0;
  for (int i = 1; i < 2 * p; i += 2) {
    if (used[i] > used[i ^ 1]) radiostations.push_back(i / 2 + 1);
  }
  for (int i = 2 * p + 1; i < cntNodes; i += 2) {
    if (used[i] > used[i ^ 1])
      funcValue++;
    else
      break;
  }
  cout << (int)radiostations.size() << ' ' << funcValue << "\n";
  for (int x : radiostations) cout << x << ' ';
}
int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(20);
  solve();
  return 0;
}
