There is a country with n citizens. The i-th of them initially has a_{i} money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receipt to the social services mentioning the amount of money they currently have.

Sometimes the government makes payouts to the poor: all citizens who have strictly less money than x are paid accordingly so that after the payout they have exactly x money. In this case the citizens don't send a receipt.

You know the initial wealth of every citizen and the log of all events: receipts and payouts. Restore the amount of money each citizen has after all events.

Input

The first line contains a single integer n (1 ≤ n ≤ 2 ⋅ 10^{5}) — the numer of citizens.

The next line contains n integers a_1, a_2, ..., a_n (0 ≤ a_{i} ≤ 10^{9}) — the initial balances of citizens.

The next line contains a single integer q (1 ≤ q ≤ 2 ⋅ 10^{5}) — the number of events.

Each of the next q lines contains a single event. The events are given in chronological order.

Each event is described as either 1 p x (1 ≤ p ≤ n, 0 ≤ x ≤ 10^{9}), or 2 x (0 ≤ x ≤ 10^{9}). In the first case we have a receipt that the balance of the p-th person becomes equal to x. In the second case we have a payoff with parameter x.

Output

Print n integers — the balances of all citizens after all events.

Examples

Input


4
1 2 3 4
3
2 3
1 2 2
2 1


Output


3 2 3 4 


Input


5
3 50 2 1 10
3
1 2 0
2 8
1 3 20


Output


8 8 20 8 10 

Note

In the first example the balances change as follows: 1 2 3 4 → 3 3 3 4 → 3 2 3 4 → 3 2 3 4

In the second example the balances change as follows: 3 50 2 1 10 → 3 0 2 1 10 → 8 8 8 8 10 → 8 8 20 8 10
#include <bits/stdc++.h>
long long Array[200010];
inline long long qr() {
  register char c = getchar();
  if (c == EOF) return -1;
  register long long n = 0;
  while (c > '9' || c < '0') {
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    n = (n << 3) + (n << 1) + c - 48;
    c = getchar();
  }
  return n;
}
inline char qrc() {
  register char c = getchar();
  while (c < 'A' && c > 'Z') c = getchar();
  return c;
}
struct segtreeModel {
  long long val;
  long long lazy_tag;
  long long l_range, r_range;
  segtreeModel *l, *r;
} T[200010 << 2];
void build(const long long &rg1, const long long &rg2, const long long ind) {
  long long mid = (rg1 + rg2) >> 1;
  T[ind].lazy_tag = -1;
  T[ind].l_range = rg1;
  T[ind].r_range = rg2;
  if (rg1 == rg2) {
    T[ind].val = Array[rg1];
    return;
  }
  T[ind].l = &T[(ind << 1) + 1];
  T[ind].r = &T[(ind << 1) + 2];
  build(rg1, mid, (ind << 1) + 1);
  build(mid + 1, rg2, (ind << 1) + 2);
  T[ind].val = std::max(T[ind].l->val, T[ind].r->val);
}
void push_down(segtreeModel *ind) {
  if (~ind->lazy_tag) {
    if (ind->l_range == ind->r_range) {
      ind->val = std::max(ind->val, ind->lazy_tag);
      ind->lazy_tag = -1;
      return;
    }
    ind->l->lazy_tag = std::max(ind->l->lazy_tag, ind->lazy_tag);
    ind->r->lazy_tag = std::max(ind->r->lazy_tag, ind->lazy_tag);
    ind->val = ind->lazy_tag;
    ind->lazy_tag = -1;
  }
}
void modify(segtreeModel *ind, const long long v) {
  ind->lazy_tag = std::max(v, ind->lazy_tag);
}
void singlemodify(const long long v, const long long pos, segtreeModel *ind) {
  push_down(ind);
  if (ind->l_range == ind->r_range)
    ind->val = v;
  else {
    if (pos <= ((ind->l_range + ind->r_range) >> 1)) {
      singlemodify(v, pos, ind->l);
    } else {
      singlemodify(v, pos, ind->r);
    }
  }
}
long long query(const long long &rg1, const long long &rg2, segtreeModel *ind) {
  push_down(ind);
  if (rg1 <= ind->l_range && ind->r_range <= rg2) {
    return ind->val;
  } else {
    long long v1 = ind->l->r_range >= rg1 ? query(rg1, rg2, ind->l) : 0;
    long long v2 = ind->r->l_range <= rg2 ? query(rg1, rg2, ind->r) : 0;
    return std::max(v1, v2);
  }
}
int main() {
  long long n, m;
  n = qr();
  long long i;
  for (i = 0; i < n; i += 1) {
    Array[i] = qr();
  }
  build(0, n - 1, 0);
  m = qr();
  for (i = 0; i < m; i += 1) {
    long long cmd = qr();
    long long o1 = qr();
    long long o2;
    switch (cmd) {
      case 1:
        o2 = qr();
        o1--;
        singlemodify(o2, o1, &T[0]);
        break;
      default:
        modify(&T[0], o1);
        break;
    }
  }
  for (i = 0; i < n; i += 1) {
    printf("%lld ", query(i, i, &T[0]));
  }
}
