#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 add_edge(int v1, int v2) {
  g[v1].push_back(v2);
  gt[v2].push_back(v1);
}
void add_disjunction(int v1, int v2) {
  add_edge(v1 ^ 1, v2);
  add_edge(v2 ^ 1, v1);
}
void dfs1(int v) {
  if (used[v]) return;
  used[v] = 1;
  for (auto u : g[v]) dfs1(u);
  order.push_back(v);
}
void dfs2(int v, int cc) {
  if (comp[v]) return;
  comp[v] = cc;
  for (auto u : gt[v]) dfs2(u, 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;
}
int main() {
  int n, p, M, m;
  scanf("%d %d %d %d", &n, &p, &M, &m);
  v = p + M - 1;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    --x;
    --y;
    add_disjunction(x * 2, y * 2);
  }
  for (int i = 0; i < p; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    if (l != 1) add_disjunction((l - 2 + p) * 2, i * 2 + 1);
    if (r != M) add_disjunction((r - 1 + p) * 2 + 1, i * 2 + 1);
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    --x;
    --y;
    add_disjunction(x * 2 + 1, y * 2 + 1);
  }
  for (int i = 2; i <= M - 1; i++) {
    int f1 = i - 2 + p;
    int f2 = f1 + 1;
    add_disjunction(f1 * 2, f2 * 2 + 1);
  }
  if (!solve2SAT()) {
    puts("-1");
    return 0;
  }
  int k = 1, f = 0;
  vector<int> stations;
  for (auto x : result)
    if (x < p)
      stations.push_back(x);
    else if (f == 0) {
      k = max(k, x - p + 2);
    }
  printf("%d %d\n", int(stations.size()), k);
  for (auto x : stations) printf("%d ", x + 1);
  return 0;
}
