#include <bits/stdc++.h>
using namespace std;
class DebugStream {
} LOG;
template <typename T>
DebugStream &operator<<(DebugStream &s, const T &) {
  return s;
}
mt19937 rnd(time(NULL));
const int maxN = 1e6 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20,
          bs = 29;
int n, p, M, m, le[maxN], ri[maxN], cle[maxN], cri[maxN],
    cc = 0, comp[maxN], freq[maxN], lado[maxN];
bool vi[maxN];
vector<int> adj[maxN], farg[maxN], cadj[maxN];
stack<int> kosa;
void prec(int nd) {
  if (vi[nd]) return;
  vi[nd] = 1;
  for (auto sn : adj[nd]) prec(sn);
  kosa.push(nd);
}
void dfs(int nd) {
  comp[nd] = cc;
  for (auto sn : farg[nd])
    if (comp[sn] == -1) dfs(sn);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> p >> M >> m;
  for (int i = 0, u, v; i < n; i++) {
    cin >> u >> v;
    u--, v--;
    adj[u << 1 | 1].push_back(v << 1);
    adj[v << 1 | 1].push_back(u << 1);
    farg[u << 1].push_back(v << 1 | 1);
    farg[v << 1].push_back(u << 1 | 1);
  }
  for (int i = 0; i < p; i++) cin >> le[i] >> ri[i], le[i]--;
  for (int i = 0, u, v; i < m; i++) {
    cin >> u >> v;
    u--, v--;
    farg[u << 1 | 1].push_back(v << 1);
    farg[v << 1 | 1].push_back(u << 1);
    adj[u << 1].push_back(v << 1 | 1);
    adj[v << 1].push_back(u << 1 | 1);
  }
  for (int i = 0; i < p * 2; i++) prec(i), comp[i] = -1;
  while (kosa.size()) {
    dfs(kosa.top());
    cle[cc] = 0, cri[cc] = maxN - 20;
    cc++;
    while (kosa.size() && comp[kosa.top()] != -1) kosa.pop();
  }
  for (int i = 0; i < 2 * p; i++) {
    if (i % 2 == 0) {
      cle[comp[i]] = max(cle[comp[i]], le[i / 2]);
      cri[comp[i]] = min(cri[comp[i]], ri[i / 2]);
    }
    for (auto sn : adj[i])
      if (comp[i] != comp[sn]) cadj[comp[i]].push_back(comp[sn]);
  }
  for (int i = cc - 1; i >= 0; i--) {
    for (auto sn : cadj[i]) {
      cle[i] = max(cle[i], cle[sn]);
      cri[i] = min(cri[i], cri[sn]);
    }
    cri[i] = max(cri[i], cle[i]);
  }
  for (int i = 0; i < p; i++) {
    if (comp[i << 1] == comp[i << 1 | 1]) {
      cout << "-1\n";
      exit(0);
    }
    freq[cle[comp[i << 1]]]++, freq[cri[comp[i << 1]]]--;
    freq[cle[comp[i << 1 | 1]]]++, freq[cri[comp[i << 1 | 1]]]--;
    int izq = max(cle[comp[i << 1]], cle[comp[i << 1 | 1]]);
    int dere = min(cri[comp[i << 1]], cri[comp[i << 1 | 1]]);
    if (izq < dere) freq[izq]--, freq[dere]++;
  }
  for (int i = 1; i < M; i++) freq[i] += freq[i - 1];
  int bueno = int(max_element(freq, freq + M) - freq);
  if (freq[bueno] < p) {
    cout << "-1\n";
    return 0;
  }
  vector<int> ans;
  for (int i = 0; i < p; i++) {
    if (comp[i << 1] < comp[i << 1 | 1]) lado[i] = 1;
    int escogido = comp[i << 1 | lado[i]];
    if (cle[escogido] > bueno || bueno >= cri[escogido]) lado[i] ^= 1;
    if (!lado[i]) ans.push_back(i);
  }
  cout << ans.size() << ' ' << bueno + 1 << '\n';
  for (auto el : ans) cout << el + 1 << ' ';
  cout << '\n';
}
