#include <bits/stdc++.h>
using namespace std;
const int MX = 4e5, MXB = MX * 3 * 3;
int n, p, M, m, N;
int x[MX], y[MX], l[MX], r[MX], u[MX], v[MX];
vector<int> adjList[MXB];
vector<int> adjListR[MXB];
bitset<MXB> vis;
stack<int> stck;
int group[MXB], groups = 0;
int get(int i, bool j) { return i * 2 + j; }
int moreThen(int i) { return p * 2 + i; }
int lessThen(int i) { return p * 2 + M + i; }
void addCompare() {
  for (int i = int(0); i < int(M - 1); i++)
    adjList[moreThen(i)].push_back(moreThen(i + 1));
  for (int i = int(1); i < int(M); i++)
    adjList[lessThen(i)].push_back(lessThen(i - 1));
  for (int i = int(0); i < int(p); i++) {
    if (l[i] != 0) {
      adjList[moreThen(l[i] - 1)].push_back(get(i, 0));
    }
    if (r[i] != M - 1) {
      adjList[lessThen(r[i] + 1)].push_back(get(i, 0));
    }
    adjList[get(i, 1)].push_back(moreThen(r[i]));
    adjList[get(i, 1)].push_back(lessThen(l[i]));
  }
}
void reverseAdj() {
  for (int i = int(0); i < int(N); i++)
    for (int j = int(0); j < int(adjList[i].size()); j++)
      adjListR[adjList[i][j]].push_back(i);
  for (int i = int(0); i < int(N); i++) adjList[i] = adjListR[i];
}
void dfs1(int u) {
  if (vis[u]) return;
  vis[u] = 1;
  for (int i = int(0); i < int(adjList[u].size()); i++) dfs1(adjList[u][i]);
  stck.push(u);
}
void dfs2(int u, int r) {
  if (vis[u]) return;
  group[u] = r;
  vis[u] = 1;
  for (int i = int(0); i < int(adjList[u].size()); i++) dfs2(adjList[u][i], r);
}
int main() {
  cin >> n >> p >> M >> m;
  N = (p + M) * 2;
  for (int i = int(0); i < int(n); i++) cin >> x[i] >> y[i], x[i]--, y[i]--;
  for (int i = int(0); i < int(p); i++) cin >> l[i] >> r[i], l[i]--, r[i]--;
  for (int i = int(0); i < int(m); i++) cin >> u[i] >> v[i], u[i]--, v[i]--;
  for (int i = int(0); i < int(n); i++) {
    adjList[get(x[i], 0)].push_back(get(y[i], 1));
    adjList[get(y[i], 0)].push_back(get(x[i], 1));
  }
  for (int i = int(0); i < int(m); i++) {
    adjList[get(u[i], 1)].push_back(get(v[i], 0));
    adjList[get(v[i], 1)].push_back(get(u[i], 0));
  }
  addCompare();
  vis.reset();
  for (int i = int(0); i < int(N); i++) dfs1(i);
  reverseAdj();
  vis.reset();
  while (!stck.empty()) {
    int i = stck.top();
    stck.pop();
    dfs2(i, groups++);
  }
  bool pos = 1;
  vector<int> ans;
  for (int i = int(0); i < int(p); i++) {
    if (group[get(i, 0)] == group[get(i, 1)]) pos = 0;
    if (group[get(i, 0)] < group[get(i, 1)]) ans.push_back(i);
  }
  if (!pos) {
    cout << -1 << endl;
  } else {
    int f = 1e9;
    for (int i = int(0); i < int(ans.size()); i++) f = min(f, r[ans[i]] + 1);
    cout << ans.size() << " " << f << endl;
    for (int i = int(0); i < int(ans.size()); i++) {
      if (i != 0) cout << " ";
      cout << ans[i] + 1;
    }
    cout << endl;
  }
}
