#include<bits/stdc++.h>
using namespace std;
int n,c[200005];
struct dataa
{
int nexx,fro;
}e[400005];
int main()
{
scanf("%d",&n);
c[0]=0;
for(int i=1;i<=n;i++)
{
scanf("%d",&c[i]);
e[c[i]].fro=c[i-1];
e[c[i-1]].nexx=c[i];
}
e[c[n]].nexx=-1;
int q,op,x,y,cnt=n;
scanf("%d",&q);
while(q--)
{
scanf("%d%d",&op,&x);
if(op==1)
{
scanf("%d",&y);
e[y].fro=x;
e[y].nexx=e[x].nexx;
e[x].nexx=y;
}
else
{
e[e[x].fro].nexx=e[x].nexx;
if(e[x].nexx!=-1)
e[e[x].nexx].fro=e[x].fro;
}
}
int t=0;
while(t!=-1)
{
t=e[t].nexx;
if(t==-1)
break;
printf("%d ",t);
}
return 0;
}
检查了一下没发现有会越界的地方啊……