#include <bits/stdc++.h>
using namespace std;
static const int maxn = 400005;
int n, p, M, m, gr_vis[maxn * 4] = {}, gr_col[maxn * 4] = {};
vector<int> gr_s[maxn * 4], gr_rs[maxn * 4], sa_ans;
stack<int> ko_ord;
void postdfs(int x) {
  gr_vis[x] = 1;
  int v;
  for (unsigned int i = 0; i < (gr_s[x]).size() && (v = (gr_s[x])[i], true);
       ++i) {
    if (!gr_vis[v]) postdfs(v);
  }
  ko_ord.push(x);
}
void paint(int x, int c) {
  gr_col[x] = c;
  int v;
  for (unsigned int i = 0; i < (gr_rs[x]).size() && (v = (gr_rs[x])[i], true);
       ++i) {
    if (!gr_col[v]) paint(v, c);
  }
}
inline void kosaraju() {
  int bruh = 0;
  for (int i = 1; i <= ((M + p) << 1); ++i)
    if (!gr_vis[i]) postdfs(i);
  while (!ko_ord.empty()) {
    if (!gr_col[ko_ord.top()]) paint(ko_ord.top(), ++bruh);
    ko_ord.pop();
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y;
  cin >> n >> p >> M >> m;
  for (int i = 1; i <= (n); ++i) {
    cin >> x >> y;
    gr_s[((x) << 1)].push_back((((y) << 1) - 1)),
        gr_rs[(((y) << 1) - 1)].push_back(((x) << 1));
    gr_s[((y) << 1)].push_back((((x) << 1) - 1)),
        gr_rs[(((x) << 1) - 1)].push_back(((y) << 1));
  }
  for (int i = 1; i <= (M - 1); ++i) {
    gr_s[((i + p + 1) << 1)].push_back(((i + p) << 1)),
        gr_rs[((i + p) << 1)].push_back(((i + p + 1) << 1));
    gr_s[(((i + p) << 1) - 1)].push_back((((i + p + 1) << 1) - 1)),
        gr_rs[(((i + p + 1) << 1) - 1)].push_back((((i + p) << 1) - 1));
  }
  for (int i = 1; i <= (p); ++i) {
    cin >> x >> y;
    gr_s[(((i) << 1) - 1)].push_back((((y + p) << 1) - 1)),
        gr_rs[(((y + p) << 1) - 1)].push_back((((i) << 1) - 1));
    if (x - 1)
      gr_s[(((i) << 1) - 1)].push_back(((x - 1 + p) << 1)),
          gr_rs[((x - 1 + p) << 1)].push_back((((i) << 1) - 1));
    gr_s[((y + p) << 1)].push_back(((i) << 1)),
        gr_rs[((i) << 1)].push_back(((y + p) << 1));
    if (x - 1)
      gr_s[(((x - 1 + p) << 1) - 1)].push_back(((i) << 1)),
          gr_rs[((i) << 1)].push_back((((x - 1 + p) << 1) - 1));
  }
  for (int i = 1; i <= (m); ++i) {
    cin >> x >> y;
    gr_s[(((x) << 1) - 1)].push_back(((y) << 1)),
        gr_rs[((y) << 1)].push_back((((x) << 1) - 1));
    gr_s[(((y) << 1) - 1)].push_back(((x) << 1)),
        gr_rs[((x) << 1)].push_back((((y) << 1) - 1));
  }
  kosaraju();
  for (int i = 1; i <= (M + p); ++i)
    if (gr_col[(((i) << 1) - 1)] == gr_col[((i) << 1)]) {
      cout << -1 << endl;
      return 0;
    }
  for (int i = 1; i <= (p); ++i)
    if (gr_col[(((i) << 1) - 1)] > gr_col[((i) << 1)]) sa_ans.push_back(i);
  cout << sa_ans.size() << ' ';
  for (int i = 1; i <= (M); ++i)
    if (gr_col[(((i + p) << 1) - 1)] > gr_col[((i + p) << 1)])
      cout << i << endl, i = M + 1;
  for (unsigned int i = 0; i < (sa_ans).size() && (y = (sa_ans)[i], true); ++i)
    cout << y << ' ';
  return 0;
}
