import java.util.*;
import java.io.*;

public class RadioStations {
    static int N;
    static ArrayList<Integer>[] graph;
    static Integer[] arr;
    static int[] comp;
    static int[] pre, ll;
    static int v;
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out,false);
        int n = scanner.nextInt();
        int p = scanner.nextInt();
        int M = scanner.nextInt();
        int m = scanner.nextInt();
        v = p + M-1;
        N = v * 2;
        graph = new ArrayList[N];
        arr = new Integer[N];
        comp = new int[N];
        for(int i =0; i < N; i++) {
            arr[i] = i;
            graph[i] = new ArrayList<>();
        }
        pre = new int[N];
        ll = new int[N];
        Arrays.fill(pre, -1);
        for(int i = 0; i < n; i++) {
            int x= scanner.nextInt()-1, y= scanner.nextInt()-1;
            addOR(x<<1,y<<1);
        }
        for(int i = 0; i < p; i++) {
            int l = scanner.nextInt(), r = scanner.nextInt();
            if (l > 1) {
                addOR((l-2+p) <<1, i * 2 + 1);
            }
            if (r < M) {
                addOR((r-1+p)*2+1, i*2 + 1);
            }
        }
        for(int i = 0; i< m; i++) {
            int u = scanner.nextInt()-1, v = scanner.nextInt()-1;
            addOR(2*u+1, 2*v+1);
        }
        for(int i = 2; i < M; i++) {
            addOR((i-2+p)*2, (i-1+p)*2+1);
        }
        stack = new ArrayDeque<>(N/4);
        for(int i = 0; i < 2 * v; i++) {
            if (pre[i] == -1) dfs(i);
        }
        int pow = 1;
        ArrayList<Integer> vals = new ArrayList<>(N/4);
        for(int i = 0; i < v; i++) {
            if (comp[i<<1] == comp[i*2+1]) {
                System.out.println(-1);
                return;
            }
            else if (comp[i << 1] < comp[i*2+1]) {
                if (i < p) vals.add(arr[i+1]);
                else pow = Math.max(pow, i - p +2);
            }
        }
        out.println(vals.size() + " " + pow);
        for(int index: vals) out.print(index + " ");
        out.println();
        out.flush();
    }
    static int cnt = 0;
    static ArrayDeque<Integer> stack;
    static void dfs(int v) {
        pre[v] = cnt++;
        ll[v] = pre[v];
        stack.push(arr[v]);
        for(int u: graph[v]) {
            if (pre[u] == -1) dfs(u);
            ll[v] = Math.min(ll[v], ll[u]);
        }
        if (pre[v] == ll[v]) {
            while(true) {
                int cur = stack.pop();
                comp[cur] = curscc;
                ll[cur] = N+1;
                if (cur == v) break;
            }
            curscc++;
        }
    }
    static int curscc = 0;
    static void addOR(int ind1, int ind2) {
        addEdge(ind1 ^ 1, ind2);
        addEdge(ind2 ^ 1, ind1);
    }
    static void addEdge(int ind1, int ind2) {
        graph[ind1].add(arr[ind2]);
    }
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
    }
}
