#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const int N = 2e6 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
int comp[N];
stack<int> st;
bool vis[N];
vector<int> g[N], rg[N];
void add(int u, int v) {
  g[u].push_back(v);
  rg[v].push_back(u);
}
void dfs(int u) {
  vis[u] = 1;
  for (auto i : g[u]) {
    if (!vis[i]) dfs(i);
  }
  st.push(u);
}
void dfs1(int u, int cur) {
  comp[u] = cur;
  for (auto i : rg[u]) {
    if (!comp[i]) dfs1(i, cur);
  }
}
void scc(int n) {
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) dfs(i);
  }
  int grp = 0;
  while (!st.empty()) {
    int x = st.top();
    st.pop();
    if (comp[x] == 0) {
      grp++;
      dfs1(x, grp);
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, p, M, m;
  cin >> n >> p >> M >> m;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    add(x + p, y);
    add(y + p, x);
  }
  for (int i = 1; i <= p; i++) {
    int l, r;
    cin >> l >> r;
    add(i, r + 2 * p);
    add(r + 2 * p + M, i + p);
    if (l > 1) {
      add(i, l - 1 + 2 * p + M);
      add(l - 1 + 2 * p, i + p);
    }
  }
  for (int i = 1; i < M; i++) {
    add(i + 2 * p, i + 2 * p + 1);
    add(i + 2 * p + 1 + M, i + 2 * p + M);
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    add(x, y + p);
    add(y, x + p);
  }
  scc(2 * n + 2 * M);
  vector<int> v;
  for (int i = 1; i <= p; i++) {
    if (comp[i] == comp[i + p])
      return cout << -1, 0;
    else if (comp[i + p] < comp[i])
      v.push_back(i);
  }
  int f = -1;
  for (int i = 1; i <= M; i++) {
    if (comp[i + 2 * p] == comp[i + 2 * p + M])
      return cout << -1, 0;
    else if (f == -1 && comp[i + 2 * p + M] < comp[i + 2 * p])
      f = i;
  }
  cout << v.size() << " " << f << '\n';
  for (auto i : v) cout << i << " ";
  return 0;
}
