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[] 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;
    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;
        for(int i = 0; i < 2*v + 5; i++) {
            graph[i] = new ArrayList<>();
            rev[i] = new ArrayList<>();
        }
        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 (!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() {
        for(int i = 0; i < v * 2; i++) dfs1(i);
        Collections.reverse(order);
        int cc = 0;
        for(int x: order) {
            if (comp[x] == 0) {
                cc++;
                dfs2(x, cc);
            }
         }
        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) {
        graph[ind1].add(ind2);
        rev[ind2].add(ind1);
    }
    static void dfs1(int v) {
        if (used[v] != 0) return;
        used[v] = 1;
        for(int i = 0; i < graph[v].size(); i++) {
            int u = graph[v].get(i);
            dfs1(u);
        }
        order.add(v);
    }
    static void dfs2(int v, int cc) {
        if (comp[v] != 0) return;
        comp[v] = cc;
        for(int i = 0; i < graph[v].size(); i++) {
            int u = graph[v].get(i);
            dfs2(u, cc);
        }
    }
    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;
        }
    }
}
