#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 2e6 + 5, LG = 19, MOD = 1e9 + 7;
const int SQ = 225;
const long double EPS = 1e-7;
vector<int> g[N], rg[N];
void addEdge(int u, int v) {
  g[u].push_back(v);
  rg[v].push_back(u);
}
void add(int u, int v) {
  addEdge(u ^ 1, v);
  addEdge(v ^ 1, u);
}
bool vis[N];
stack<int> stk;
void dfs1(int u) {
  if (vis[u]) return;
  vis[u] = true;
  for (auto v : g[u]) dfs1(v);
  stk.push(u);
}
int cmp[N];
void dfs2(int u, int cnt) {
  if (cmp[u]) return;
  cmp[u] = cnt;
  for (auto v : rg[u]) dfs2(v, cnt);
}
vector<int> out;
bool killSat(int node) {
  for (int i = 0; i < node * 2; i++) {
    dfs1(i);
  }
  int cnt = 0;
  while (stk.size()) {
    auto x = stk.top();
    stk.pop();
    if (!cmp[x]) dfs2(x, ++cnt);
  }
  for (int i = 0; i < node; i++)
    if (cmp[i << 1] == cmp[i << 1 | 1])
      return false;
    else if (cmp[i << 1] > cmp[i << 1 | 1])
      out.push_back(i);
  return true;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, p, M, m;
  cin >> n >> p >> M >> m;
  for (int i = 0; i < n; i++) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    add(u << 1, v << 1);
  }
  for (int i = 0; i < p; i++) {
    int l, r;
    cin >> l >> r;
    --l, --r;
    if (l) add((p + l - 1) << 1, i << 1 | 1);
    if (r != M - 1) add((p + r) << 1 | 1, i << 1 | 1);
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    add(u << 1 | 1, v << 1 | 1);
  }
  for (int i = 2; i < M; i++) {
    int u = p + i - 2;
    int v = u + 1;
    add(u << 1, v << 1 | 1);
  }
  if (!killSat(p + M - 1)) {
    cout << -1 << '\n';
    return 0;
  }
  int f = 1;
  vector<int> res;
  for (auto x : out)
    if (x < p)
      res.push_back(x + 1);
    else
      f = max(f, x - p + 2);
  cout << res.size() << ' ' << f << '\n';
  for (auto x : res) cout << x << " ";
  return 0;
}
