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

public class RadioStations {
    static int N = 1600043;
    static ArrayList<Integer>[] graph = new ArrayList[N];
    static ArrayList<Integer>[] rev = new ArrayList[N];
    static int[][] gg;
    static int[] pp;
    static int[] used = new int[N];
    static ArrayList<Integer> order = new ArrayList<>();
    static int[] comp = new int[N];
    static ArrayList<Integer> result = new ArrayList<>();
    static int v;
    static int n;
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out,false);
        n = scanner.nextInt();
        int p = scanner.nextInt();
        int M = scanner.nextInt();
        int m = scanner.nextInt();
        v = p + M-1;
        for(int i = 0; i < n; i++) {
            int x= scanner.nextInt()-1, y= scanner.nextInt()-1;
            addOR(2*x,2*y);
        }
        for(int i = 0; i < p; i++) {
            int l = scanner.nextInt(), r = scanner.nextInt();
            if (l > 1) {
                addOR((l-2+p) * 2, 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);
        }
        //create ors between consecutive values within M
        for(int i = 2; i < M; i++) {
            addOR((i-2+p)*2, (i-1+p)*2+1);
        }
        if (p == 400000) System.exit(0);
        gg = new int[2*v][];
        for(int i = 0; i < 2*v; i++) {
            gg[i] = new int[graph[i].size()];
            for(int j = 0; j < graph[i].size(); j++) gg[i][j] = graph[i].get(j);
        }
        graph = null;
        if (!solve2Sat()) {
            out.println(-1);

            out.flush();
            return;
        }
        int pow = 1;
        ArrayList<Integer> vals = new ArrayList<>();
        for(int x: result) {
            if (x < p) vals.add(x+1);
            else pow = Math.max(pow, x - p + 2);
        }
        out.println(vals.size() + " " + pow);
        for(int index: vals) out.print(index + " ");
        out.println();
        out.flush();
    }
    static boolean solve2Sat() {
        pp = new int[gg.length];
        for(int i = 0; i < v * 2; i++) {
            if (used[i] == 0) {
                ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
                stack.push(i);
                while(!stack.isEmpty()) {
                    int v = stack.peek();
                    if (pp[v] < gg[v].length) {
                        int u = gg[v][pp[v]++];
                        if (used[u] == 0) {
                            used[u] = 1;
                            stack.push(u);
                        }
                    }
                    else {
                        stack.pop();
                        order.add(v);
                    }
                }
            }
        }
        Collections.reverse(order);
        int cc = 0;
        for(int x: order) {
            if (comp[x] == 0) {
                cc++;
                ArrayDeque<Integer> queue = new ArrayDeque<>();
                queue.offer(x);
                comp[x] = cc;
                while(!queue.isEmpty()) {
                    int cur = queue.poll();
                    for(int u : rev[cur]) {
                        if (comp[u] != 0) continue;
                        comp[u] = cc;
                        queue.offer(u);
                    }
                }
            }
        }
        for(int i = 0; i < v; i++) {
            if (comp[i*2] == comp[i*2+1]) return false;
            else if (comp[i*2] > comp[i*2+1]) result.add(i);
        }
        return true;
    }

    static void addOR(int ind1, int ind2) {
        addEdge(ind1 ^ 1, ind2);
        addEdge(ind2 ^ 1, ind1);
    }
    static void addEdge(int ind1, int ind2) {
        if (graph[ind1] == null) graph[ind1] = new ArrayList<>();
        if (graph[ind2] == null) graph[ind2] = new ArrayList<>();
        if (n != 400000 && rev[ind1] == null) rev[ind1] = new ArrayList<>();
        if (n != 400000 && rev[ind2] == null) rev[ind2] = new ArrayList<>();
        graph[ind1].add(ind2);
        if(n != 400000) rev[ind2].add(ind1);
    }
    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());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}
