#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
#define int long long
int a[maxn], l[maxn], r[maxn], tot = 0;
map<int,int> pos;
map<int,int> v;
void inst(int x,int i) {
v[++tot] = x;
pos[x] = tot;
r[tot] = r[i]; r[i] = tot; l[tot] = i; l[r[tot]] = tot;
}
void del(int i) {
l[r[i]] = l[i]; r[l[i]] = r[i];
pos[v[i]] = 0; l[i] = r[i] = 0;
}
int n, m;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> n;
for (int i = 1;i <= n;i++) cin >> a[i];
for (int i = 1;i <= n;i++) inst(a[i],i-1);
cin >> m;
while (m--) {
int op, x, y;
cin >> op >> x;
if (op == 1) {
cin >> y;
inst(y,pos[x]);
}
else del(pos[x]);
}
int head = 0, tail = 0;
for (int i = 0;!i;i = r[i]) head = r[i];
for (int i = head;i;i = r[i]) {
cout << v[i] << ' ';
}
return 0;
}