#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#pragma G++ optimize("O2")
#pragma GCC optimize("O3")
#pragma G++ optimize("O3")
using namespace std;
const int N = 444444;
const int M = 1666666;
const int MOD = 1e9 + 7;
const int intINF = 1e9;
const long long llINF = 2e18;
const double pi = acos(-1.0);
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double eps = 1e-10;
int read() {
  int v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
long long readll() {
  long long v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
unsigned long long readull() {
  long long v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
vector<int> G[M];
int num[N][2], lim[N][2], flag[M], dfn[M], low[M], belong[M], stk[M], n, m, n1,
    n2, cnt, top, tim, id;
void predo() {}
void add(int a, int b) { G[a].push_back(b); }
void init() {
  n1 = read(), n = read(), m = read(), n2 = read();
  cnt = 0;
  for (int i = (int)1; i <= (int)n; i++) {
    num[i][0] = ++cnt;
    num[i][1] = ++cnt;
  }
  for (int i = (int)0; i <= (int)m; i++) {
    lim[i][0] = ++cnt;
    lim[i][1] = ++cnt;
  }
  for (int i = (int)1; i <= (int)n1; i++) {
    int x = read(), y = read();
    add(num[x][0], num[y][1]);
    add(num[y][0], num[x][1]);
  }
  for (int i = (int)0; i <= (int)m - 1; i++) {
    add(lim[i][1], lim[i + 1][1]);
    add(lim[i + 1][0], lim[i][0]);
  }
  add(lim[0][1], lim[0][0]);
  for (int i = (int)1; i <= (int)n; i++) {
    int l = read(), r = read();
    add(num[i][1], lim[l - 1][0]);
    add(lim[l - 1][1], num[i][0]);
    add(num[i][1], lim[r][1]);
    add(lim[r][0], num[i][0]);
    add(lim[l - 1][1], num[i][0]);
    add(num[i][1], lim[l - 1][0]);
    add(lim[r][0], num[i][0]);
    add(num[i][1], lim[r][1]);
  }
  for (int i = (int)1; i <= (int)n2; i++) {
    int x = read(), y = read();
    add(num[x][1], num[y][0]);
    add(num[y][1], num[x][0]);
  }
}
void dfs(int u) {
  flag[u] = 1;
  stk[++top] = u;
  dfn[u] = low[u] = ++tim;
  for (auto v : G[u]) {
    if (!flag[v]) {
      dfs(v);
      low[u] = min(low[u], low[v]);
    } else if (!belong[v])
      low[u] = min(low[u], low[v]);
  }
  if (low[u] == dfn[u]) {
    id++;
    while (stk[top] != u) {
      belong[stk[top]] = id;
      top--;
    }
    belong[stk[top]] = id;
    top--;
  }
}
void solve() {
  tim = 0;
  id = 0;
  for (int i = (int)1; i <= (int)cnt; i++) {
    if (!flag[i]) dfs(i);
  }
  for (int i = (int)1; i <= (int)n; i++) {
    if (belong[num[i][0]] == belong[num[i][1]]) {
      printf("-1\n");
      return;
    }
  }
  vector<int> ans;
  ans.clear();
  for (int i = (int)1; i <= (int)n; i++) {
    if (belong[num[i][1]] < belong[num[i][0]]) ans.push_back(i);
  }
  int res;
  for (int i = (int)1; i <= (int)m; i++) {
    if (belong[lim[i][1]] < belong[lim[i][0]]) {
      res = i;
      break;
    }
  }
  printf("%d %d\n", (int)ans.size(), res);
  for (auto t : ans) printf("%d ", t);
}
int main() {
  predo();
  int cas = 1;
  while (cas--) {
    init();
    solve();
  }
  return 0;
}
