#include <bits/stdc++.h>

using namespace std;

#define all(v) v.begin(), v.end()

int main()
{
	int n,l1,m,l2,k,q;
	cin>>n>>l1>>m>>l2>>k>>q;
	int a[n],b[m];
	int id=0;
	for (int j=0;j<l1;j++)
	{
		int x,y;
		cin>>x>>y;
		while (x--)
			a[id++]=y;
	}
	id=0;
	for (int j=0;j<l2;j++)
	{
		int x,y;
		cin>>x>>y;
		while (x--)
			b[id++]=y;
	}
	map<int,vector<int>> ind,ind1;
	for (int i=0;i<n;i++)
		ind[a[i]]=ind1[a[i]]={};
	for (int j=0;j<m;j++)
		ind[b[j]]=ind1[b[j]]={};
	for (int i=0;i<n;i++)
		ind[a[i]].push_back(i);
	for (int i=0;i<m;i++)
		ind1[b[i]].push_back(i);
	bool dp[n][m]={};
	for (int i=n-1;i>=0;i--)
	{
		int cnt=0;
		for (int j=m-1;j>=0;j--)
		{
			if (a[i]==b[j])
			{
				if (!cnt)
					dp[i][j]=1;
				// if (cnt==1)
				// {
					// int x=upper_bound(all(ind[b[j]]),i)-begin(ind[b[j]]);
					// int y=upper_bound(all(ind1[b[j]]),j)-begin(ind1[b[j]]);
					// if (x!=ind[b[j]].size() && y!=ind1[b[j]].size() && dp[ind[b[j]][x]][ind1[b[j]][y]])
						// dp[i][j]=1;
				// }
			}
			int x=upper_bound(all(ind[b[j]]),i)-begin(ind[b[j]]);
			int y=upper_bound(all(ind1[b[j]]),j)-begin(ind1[b[j]]);
			if (x!=ind[b[j]].size() && y!=ind1[b[j]].size())
				cnt-=dp[ind[b[j]][x]][ind1[b[j]][y]];
			if (x!=ind[b[j]].size())
				cnt+=dp[ind[b[j]][x]][j];
		}
	}
	while (q--)
	{
		int x,y;
		cin>>x>>y;
		if (dp[x][y])
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}
	
	return 0;
}