#include<set>
#include<stack>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
# define ll long long
# define read read1<int>()
# define Type template<typename T>
Type inline const T read1(){
    T m=0;
    char k=getchar();
    while(('0'>k||k>'9')&&(k!='-'))k=getchar();
    const bool f=(k=='-'?1:0);
    if(f)k=getchar();
    while('0'<=k&&k<='9')m=(m<<3)+(m<<1)+(k^48),k=getchar();
    return f?-m:m;
}
# define N 800000
# define S N<<1|1
vector<int>G[S];
int dfn[S],low[S],t,cnt,fr[S];
bool vis[S];
stack<int>sta;
void tarjan(int n){
    dfn[n]=low[n]=++t;
    sta.push(n);vis[n]=1;
    for(int i=0;i<G[n].size();++i)
        if(!dfn[G[n][i]])tarjan(G[n][i]),low[n]=min(low[n],low[G[n][i]]);
        else if(vis[G[n][i]])low[n]=min(low[n],dfn[G[n][i]]);
    if(dfn[n]==low[n]){ 
        ++cnt;
        do{
            n=sta.top();
            fr[n]=cnt;vis[n]=0;
            sta.pop();
        }while(dfn[n]!=low[n]);
    }
}
int main(){
    int n=read,p=read,M=read,m=read;
    for(int i=0;i<n;++i){
        int u=read-1,v=read-1;
        G[u+M<<1].push_back(v+M<<1|1);
        G[v+M<<1].push_back(u+M<<1|1);
    }
    for(int i=1;i<M;++i)
        G[i-1<<1].push_back(i<<1),
        G[i-1<<1|1].push_back(i<<1|1);
    for(int i=0;i<p;++i){
        int l=read-1,r=read;
        G[i+M<<1|1].push_back(l<<1);
        G[l<<1|1].push_back(i+M<<1);
        G[i+M<<1|1].push_back(r<<1|1);
        G[r<<1].push_back(i+M<<1);
    }
    for(int i=0;i<m;++i){
        int u=read-1,v=read-1;
        G[u+M<<1|1].push_back(v+M<<1);
        G[v+M<<1|1].push_back(u+M<<1);
    }
    for(int i=0;i<(M+p<<1);++i)
        if(!dfn[i])tarjan(i);
    for(int i=0;i<M+p;++i)
        if(fr[i<<1]==fr[i<<1|1])
            return puts("-1"),0;
    int ans=0;
    for(int i=0;i<p;++i)
        if(fr[i+M<<1]>fr[i+M<<1|1])
            ++ans;
    for(int i=0;i<M;++i)
        if(fr[i<<1]<fr[i<<1|1]){
            printf("%d %d\n",ans,i+1);
            break;
        }
    for(int i=0;i<p;++i)
        if(fr[i+M<<1]>fr[i+M<<1|1])
            printf("%d ",i+1);
	return 0;
}