#include<bits/stdc++.h>
using namespace std;
int main(){
//	freopen("match.in","r",stdin);
//	freopen("match.out","w",stdout);
	scanf("%d%d",&T,&n);
	for(int i=1;i<n+1;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<n+1;i++)
		scanf("%d",&b[i]);
	scanf("%d",&Q);
	while(Q--){
		scanf("%d%d",&l,&r);
		
	}
	return 0;
}