#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000010;
int n, p, k, m;
int indSCC[MAXN];
bool mark[MAXN][2];
vector<int> ord;
vector<int> adj[MAXN][2];
int getAff(int cur) { return 2 * (cur - 1); }
int getNeg(int cur) { return getAff(cur) ^ 1; }
void DFS(int cur, int ind) {
  mark[cur][ind] = true;
  for (int i = 0; i < adj[cur][ind].size(); i++) {
    int viz = adj[cur][ind][i];
    if (mark[viz][ind]) continue;
    if (ind == 1) indSCC[viz] = indSCC[cur];
    DFS(viz, ind);
  }
  if (ind == 0) ord.push_back(cur);
}
bool hasSolution() {
  for (int i = 0; i <= getNeg(p + k); i++)
    if (!mark[i][0]) DFS(i, 0);
  int cntSCC = 0;
  while (!ord.empty()) {
    int cur = ord.back();
    ord.pop_back();
    if (mark[cur][1]) continue;
    indSCC[cur] = ++cntSCC;
    DFS(cur, 1);
  }
  for (int i = 1; i <= p + k; i++)
    if (indSCC[getAff(i)] == indSCC[getNeg(i)]) return false;
  return true;
}
void addEdge(int U, int V) {
  adj[U][0].push_back(V);
  adj[V][1].push_back(U);
}
void addClause(int x, int y) {
  addEdge(x ^ 1, y);
  addEdge(y ^ 1, x);
}
int main() {
  scanf("%d %d %d %d", &n, &p, &k, &m);
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    addClause(getAff(x), getAff(y));
  }
  for (int i = 1; i <= p; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    addClause(getNeg(i), getAff(p + l));
    if (r < k) addClause(getNeg(i), getNeg(p + r + 1));
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    addClause(getNeg(u), getNeg(v));
  }
  for (int i = 1; i < k; i++) addClause(getAff(p + i), getNeg(p + i + 1));
  if (!hasSolution()) {
    printf("-1\n");
    return 0;
  }
  vector<int> stations;
  for (int i = 1; i <= p; i++)
    if (indSCC[getAff(i)] > indSCC[getNeg(i)]) stations.push_back(i);
  int f = 0;
  for (int i = p + 1; i <= p + k; i++)
    if (indSCC[getAff(i)] > indSCC[getNeg(i)]) f = i - p;
  printf("%d %d\n", (int)stations.size(), f);
  for (int i = 0; i < stations.size(); i++) printf("%d ", stations[i]);
}
