#include<bits/stdc++.h>
using namespace std;
inline long long read(){
	long long x=0,f=1;char ch=getchar();
	while ((!isdigit(ch))&&(ch!='-')) ch=getchar();
	if (ch=='-') f=-1,ch=getchar();
	while (isdigit(ch)) x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	return x*f;
}
long long stop,j,n,m,K,i,a[1001010],step,opt,cas;
vector<long long> A[1001010];
int main(){
	freopen("meow2.in","r",stdin);
	n=read();m=read();K=read();
	for (i=1;i<=m;i++) a[i]=read();
	freopen("meow2.ans","r",stdin);
	step=read();
	for (i=1;i<=step;i++){
		opt=read();cas=read();
		if (opt==1){
			A[cas].push_back(a[i]);
			stop=i;
		}
		else break;
	}
	for (j=stop+1;j<=m;j++)
	     if (a[j]==16) cout<<j<<endl;
	//freopen("my.out","w",stdout);
	cout<<A[8][0]<<" "<<A[9][0]<<endl;
	/*for (i=1;i<=10;i++){
		for (j=0;j<A[i].size();j++)
		   cout<<A[i][j]<<" ";
		puts("");
		puts("------------");
	}*/
	return 0;
}
