#include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 5;   const double eps = 1e-8;   const int INF = 0x3f3f3f3f;   const int mod = 1e9 + 7;   const int seed = 131;   int n, a[maxn], q;   struct node {     int l, r, sum, lazy;   } Q[maxn << 2];   void build(int rt, int l, int r) {     Q[rt].l = l, Q[rt].r = r;     if (l == r) {       Q[rt].sum = a[l];       return;     }     int mid = (l + r) / 2;     build((rt << 1), l, mid);     build(((rt << 1) | 1), mid + 1, r);   }   inline void pushdown(int rt) {     if (Q[(rt << 1)].l == Q[(rt << 1)].r)       Q[(rt << 1)].sum = max(Q[(rt << 1)].sum, Q[rt].lazy);     else       Q[(rt << 1)].lazy = max(Q[(rt << 1)].lazy, Q[rt].lazy);     if (Q[((rt << 1) | 1)].l == Q[((rt << 1) | 1)].r)       Q[((rt << 1) | 1)].sum = max(Q[((rt << 1) | 1)].sum, Q[rt].lazy);     else       Q[((rt << 1) | 1)].lazy = max(Q[((rt << 1) | 1)].lazy, Q[rt].lazy);     Q[rt].lazy = 0;   }   void update(int rt, int p, int x) {     if (Q[rt].l == Q[rt].r) {       Q[rt].sum = x;       return;     }     pushdown(rt);     int mid = (Q[rt].l + Q[rt].r) / 2;     if (p <= mid)       update((rt << 1), p, x);     else       update(((rt << 1) | 1), p, x);   }   void show(int rt) { cout << Q[rt].l <<     << Q[rt].r <<   n ; }   void query(int rt) {     if (Q[rt].l == Q[rt].r) {       cout << Q[rt].sum;       if (Q[rt].l != n)         cout <<    ;       else         cout <<   n ;       return;     }     pushdown(rt);     query((rt << 1));     query(((rt << 1) | 1));   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     build(1, 1, n);     scanf( %d , &q);     int op, x, y;     for (int i = 1; i <= q; i++) {       scanf( %d , &op);       if (op == 1) {         scanf( %d %d , &x, &y);         update(1, x, y);       } else {         scanf( %d , &x);         if (n == 1)           Q[1].sum = max(Q[1].sum, x);         else if (n > 1 && Q[1].lazy < x)           Q[1].lazy = x;       }     }     query(1);     return 0;   }   