#include <bits/stdc++.h>
using namespace std;
long double PI = 3.14159265359;
long long inf = 1000000000000000007;
long long mod = 1000000007;
long long mod1 = 998244353;
const bool multi = 0;
vector<long long> G[4000007];
bool odw[4000007];
bool ans[4000007];
vector<long long> post;
void dfs(long long v) {
  odw[v] = 1;
  for (auto u : G[v])
    if (!odw[u]) dfs(u);
  post.push_back(v);
}
void ustaw(long long v) {
  ans[v] = 1;
  for (auto u : G[v])
    if (!ans[u]) ustaw(u);
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tt;
  if (multi)
    cin >> tt;
  else
    tt = 1;
  while (tt--) {
    long long n, p, M, m;
    cin >> n >> p >> M >> m;
    for (long long i = 0; i < n; i++) {
      long long a, b;
      cin >> a >> b;
      G[2 * a + 1].push_back(2 * b);
      G[2 * b + 1].push_back(2 * a);
    }
    for (long long i = p + 1; i <= p + M; i++) {
      G[2 * i].push_back(2 * (i + M));
      G[2 * (i + M) + 1].push_back(2 * i + 1);
      G[2 * i].push_back(2 * (i + M * 2));
      G[2 * (i + 2 * M) + 1].push_back(2 * i + 1);
    }
    for (long long i = p + M + 1; i < p + 2 * M; i++) {
      G[2 * i].push_back(2 * (i + 1 - M) + 1);
      G[2 * i].push_back(2 * (i + 1));
      G[2 * (i + 1) + 1].push_back(2 * i + 1);
      G[2 * (i + 1 - M)].push_back(2 * i + 1);
    }
    G[2 * (p + 2 * M) + 1].push_back(2 * (p + 2 * M));
    for (long long i = p + M * 2 + 1; i < p + 3 * M; i++) {
      G[2 * (i + 1)].push_back(2 * i);
      G[2 * i + 1].push_back(2 * (i + 1) + 1);
      G[2 * (i + 1)].push_back(2 * (i - 2 * M) + 1);
      G[2 * (i - 2 * M)].push_back(2 * (i + 1) + 1);
    }
    G[2 * (p + 2 * M + 1) + 1].push_back(2 * (p + 2 * M + 1));
    for (long long i = p + M + 1; i < p + 2 * M; i++) {
      G[2 * i + 1].push_back(2 * (i + M + 1));
      G[2 * (i + M + 1) + 1].push_back(2 * i);
    }
    for (long long i = 1; i <= p; i++) {
      long long l, r;
      cin >> l >> r;
      if (l != 1) G[2 * i].push_back(2 * (p + M + l - 1) + 1);
      if (r != M) G[2 * i].push_back(2 * (n + 2 * M + r + 1) + 1);
    }
    for (long long i = 0; i < m; i++) {
      long long a, b;
      cin >> a >> b;
      G[2 * a].push_back(2 * b + 1);
      G[2 * b].push_back(2 * a + 1);
    }
    for (long long i = 2; i <= 2 * (p + 3 * M) + 1; i++)
      if (!odw[i]) dfs(i);
    for (auto x : post)
      if (!ans[x] && !ans[x ^ 1]) ustaw(x);
    for (long long i = 1; i <= p + 3 * M; i++) {
      if (ans[2 * i] == ans[2 * i + 1]) {
        cout << -1;
        return 0;
      }
    }
    vector<long long> res;
    long long k = -1;
    for (long long i = 1; i <= p; i++)
      if (ans[2 * i]) res.push_back(i);
    for (long long i = p + M + 1; i <= p + 2 * M; i++)
      if (k == -1 && ans[2 * i]) k = i - p - M;
    cout << (long long)(res).size() << " " << k << '\n';
    for (auto x : res) cout << x << " ";
  }
  return 0;
}
