#include <bits/stdc++.h>
const int maxn = 4e6 + 100;
using namespace std;
int n, m, tot, color;
int dfn[maxn], low[maxn], col[maxn], sta[maxn], vis[maxn];
int cnt;
int p, mm;
vector<int> mp[maxn];
int yes(int u) { return u << 1; }
int no(int u) { return u << 1 | 1; }
void tarjan(int u) {
  cnt++;
  dfn[u] = low[u] = cnt;
  vis[u] = 1;
  sta[++tot] = u;
  for (int v : mp[u]) {
    if (dfn[v] == -1) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
    } else if (vis[v])
      low[u] = min(low[u], low[v]);
  }
  if (dfn[u] == low[u]) {
    color++;
    col[u] = color;
    vis[u] = 0;
    while (sta[tot] != u) {
      col[sta[tot]] = color;
      vis[sta[tot]] = 0;
      tot--;
    }
    tot--;
  }
}
bool two_sat() {
  for (int i = 0; i <= no(p + mm); i++) {
    dfn[i] = -1;
  }
  for (int i = 0; i <= no(p + mm); i++) {
    if (dfn[i] == -1) {
      tarjan(i);
    }
  }
  for (int i = 0; i <= p + mm; i++) {
    if (col[yes(i)] == col[no(i)]) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> p >> mm >> m;
  int a, b;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    a--;
    b--;
    mp[no(a)].push_back(yes(b));
    mp[no(b)].push_back(yes(a));
  }
  for (int i = 0; i < mm; i++) {
    mp[yes(p + i)].push_back(yes(p + i + 1));
    mp[no(p + i + 1)].push_back(no(p + i));
  }
  mp[yes(p)].push_back(no(p));
  for (int i = 0; i < p; i++) {
    cin >> a >> b;
    mp[yes(i)].push_back(no(p + a - 1));
    mp[yes(p + a - 1)].push_back(no(i));
    mp[yes(i)].push_back(yes(p + b));
    mp[no(p + b)].push_back(no(i));
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--;
    b--;
    mp[yes(a)].push_back(no(b));
    mp[yes(b)].push_back(no(a));
  }
  int k = 0;
  if (two_sat()) {
    for (int i = 0; i < p; i++) {
      if (col[yes(i)] < col[no(i)]) k++;
    }
    for (int i = 0; i < mm; i++) {
      if (col[yes(p + i + 1)] < col[no(p + i + 1)]) {
        cout << k << " " << i + 1 << endl;
        break;
      }
    }
    for (int i = 0; i < p; i++) {
      if (col[yes(i)] < col[no(i)]) {
        cout << i + 1 << " ";
      }
    }
  } else
    cout << "-1" << endl;
  return 0;
}
