// luogu-judger-enable-o2
// luogu-judger-enable-o2
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#define reset(a) memset((a),0,sizeof((a)))
using namespace std;
#define gc getchar()
inline int read(){
	register int x(0);register char c(gc);
	while(c>'9'||c<'0')c=gc;
	while(c>='0'&&c<='9')x=x*10+c-48,c=gc;
	return x;
}
const int N=2001000;
struct edge{
	int to,next;
}e[N<<3];
int head[N],tot,HEAD[N];
int n,m,M,p;
int b[N],in[N],out[N],rootin,rootout,dian;
int cnt,turn[N],belong[N],vis[N];
void add(int x,int y){
	e[++tot].to=y;e[tot].next=head[x];head[x]=tot;
	e[++tot].to=x;e[tot].next=HEAD[y];HEAD[y]=tot;
}
void dfs1(int u){
	int i;
	vis[u]=1;
	for(i=head[u];i;i=e[i].next)
		if(!vis[e[i].to])
			dfs1(e[i].to);
	turn[++cnt]=u;
}
void dfs2(int u){
	belong[u]=cnt;vis[u]=1;
	for(int i=HEAD[u];i;i=e[i].next)
		if(!vis[e[i].to])
			dfs2(e[i].to);
}
void kosaraju(){
	for(int i=1;i<=dian;i++)
		if(!vis[i])dfs1(i);
	reset(vis);cnt=0;
	for(int i=dian;i>=1;i--)
		if(!vis[turn[i]])
			cnt++,dfs2(turn[i]);
}
struct node{
	int id,l,r;
}a[N];
bool cmp(node x,node y){
	return x.l<y.l;
}
/*#define mid ((l+r)>>1)
int Ls[N],Rs[N];
#define ls Ls[id]
#define rs Rs[id]
int buildin(int l,int r,int id){
	if(l==r){
		return a[l].id+m;
	}
	if(!id)id=++dian;
	ls=buildin(l,mid,ls);
	rs=buildin(mid+1,r,rs);
	add(id,ls);
	add(id,rs);
	return id;
}
int buildout(int l,int r,int id){
	if(l==r){
		return a[l].id;
	}
	if(!id)id=++dian;
	ls=buildout(l,mid,ls);
	rs=buildout(mid+1,r,rs);
	add(ls,id);
	add(rs,id);
	return id;
}
void In(int l,int r,int root,int x,int y,int id){
	if(l>=x&&r<=y){
		add(root,id);
		return;
	}
	if(x<=mid)In(l,mid,root,x,y,ls);
	if(y>mid)In(mid+1,r,root,x,y,rs);
}
void Out(int l,int r,int root,int x,int y,int id){
	if(l>=x&&r<=y){
		add(id,root);
		return;
	}
	if(x<=mid)Out(l,mid,root,x,y,ls);
	if(y>mid)Out(mid+1,r,root,x,y,rs);
}*/
int ans[N],anscnt,suf1[N],suf2[N];
int main(){
//	freopen("F.out","w",stdout);
	register int i;
	n=read();m=read();M=read();p=read();dian=2*m;
	for(i=1;i<=n;i++){
		int x=read(),y=read();
		add(y+m,x);add(x+m,y);
	}
	for(i=1;i<=m;i++){
		a[i].id=i;a[i].l=read();a[i].r=read();
	}
	for(i=1;i<=p;i++){
		int x=read(),y=read();
		add(x,y+m);add(y,x+m);
	}
	sort(a+1,a+1+m,cmp);
	for(i=1;i<=m;i++)b[i]=a[i].l;
//	rootin=buildin(1,m,rootin);rootout=buildout(1,m,rootout);
	for(i=m;i>=1;i--){
		suf1[i]=++dian;
		add(a[i].id,suf1[i]);
		suf2[i]=++dian;
		add(suf2[i],a[i].id+m);
		if(i!=m)add(suf2[i],suf2[i+1]),add(suf1[i+1],suf1[i]);
	}
	for(i=1;i<=m;i++){
		int v=upper_bound(b+1,b+1+m,a[i].r)-b;
		if(v<=m){
			//In(1,m,a[i].id,v,m,rootin);
			add(a[i].id,suf2[v]);
			add(suf1[v],a[i].id+m);
			//Out(1,m,a[i].id+m,v,m,rootout);
		}
	}
	kosaraju();
	int L=0,R=M;
	for(i=1;i<=m;i++){
		if(belong[a[i].id]!=belong[a[i].id+m]&&belong[a[i].id]>belong[a[i].id+m]){
			ans[++anscnt]=a[i].id;
			L=max(a[i].l,L);R=min(a[i].r,R);
		}
	}
	if(L>R||!anscnt){
		cout<<-1;return 0;
	}
	else{
		cout<<anscnt<<' '<<L<<'\n';
		for(i=1;i<=anscnt;i++)cout<<ans[i]<<' ';
	}
	return 0;
}
