#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
const int maxn=2000006;
struct Edge
{
	int to,nxt;
}edge[maxn<<3];
int head[maxn],tot;
void addedge(int x,int y)
{
	edge[++tot].to=y;edge[tot].nxt=head[x];head[x]=tot;
}
int col[maxn],sta[maxn],dfn[maxn],low[maxn],cnt,top,vis[maxn];
void tarjan(int p)
{
	dfn[p]=low[p]=++cnt;
	sta[++top]=p;vis[p]=1;
	for(int i=head[p];i;i=edge[i].nxt)
	{
		int q=edge[i].to;
		if(!dfn[q])
		{
			tarjan(q);low[p]=min(low[p],low[q]);
		}
		else if(vis[q])low[p]=min(low[p],dfn[q]);
	}
	if(low[p]==dfn[p])
	{
		tot++;
		int q;
		do
		{
			q=sta[top--];col[q]=tot;vis[q]=0;
		}while(q!=p);
	}
}
int l[maxn],r[maxn];
vector<int>ans;
int main()
{
	int x,y;
	int n,p,M,m;
	scanf("%d%d%d%d",&n,&p,&M,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&x,&y);
		addedge(x+p,y);addedge(y+p,x);
	}
	for(int i=1;i<=p;i++)
	{
		scanf("%d%d",&x,&y);
		l[i]=x;r[i]=y;
		x++,y++;
		//addedge(i,2*p+M+x);addedge(i,2*p+y+1);
		//addedge(2*p+x,i+p);addedge(2*p+M+y+1,i+p);

		addedge(i,2*p+1+x-1);addedge(2*p+1+M+x-1,i+p);
		addedge(2*p+y+1,i+p);addedge(i,2*p+1+M+y);
	}
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&x,&y);
		addedge(x,y+p);addedge(y,x+p);
	}
	for(int i=1;i<M;i++)
	{
		//addedge(2*p+i,2*p+i+1);addedge(2*p+M+i+1,2*p+i+M);
		addedge(2*p+i+1,2*p+i);addedge(2*p+M+i,2*p+i+M+1);

	}
	tot=0;
	for(int i=0;i<=p*2+M*2+1;i++)
		if(!dfn[i])tarjan(i);
	int L=1,R=M;
	for(int i=1;i<=p;i++)
	{
		if(col[i]==col[i+p])
		{
			printf("-1");return 0;
		}
		else if(col[i]<col[i+p])
		{
			ans.push_back(i);L=max(L,l[i]),R=min(R,r[i]);
		}
	}
	printf("%d %d\n",(int)ans.size(),L);
	for(int i=0;i<ans.size();i++)printf("%d ",ans[i]);
	return 0;
}