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>
using namespace std;
const int inf = 2e9;
const int maxn = 2e5 + 10;
int d[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
int minn[maxn << 2], sminn[maxn << 2], lazy[maxn << 2], a[maxn];
void pushup(int rt) {
  if (minn[rt << 1] != minn[(rt << 1) + 1]) {
    minn[rt] = min(minn[rt << 1], minn[(rt << 1) + 1]);
    sminn[rt] = min(max(minn[rt << 1], minn[(rt << 1) + 1]),
                    min(sminn[rt << 1], sminn[(rt << 1) + 1]));
  } else {
    minn[rt] = minn[rt << 1];
    sminn[rt] = min(sminn[rt << 1], sminn[(rt << 1) + 1]);
  }
}
void pushdown(int rt) {
  if (lazy[rt] != -1) {
    if (minn[rt << 1] < lazy[rt] && sminn[rt << 1] > lazy[rt]) {
      minn[rt << 1] = lazy[rt];
      lazy[rt << 1] = lazy[rt];
    }
    if (minn[(rt << 1) + 1] < lazy[rt] && sminn[(rt << 1) + 1] > lazy[rt]) {
      minn[(rt << 1) + 1] = lazy[rt];
      lazy[(rt << 1) + 1] = lazy[rt];
    }
    lazy[rt] = -1;
  }
}
void build(int rt, int L, int R) {
  lazy[rt] = -1;
  if (L == R) {
    minn[rt] = a[L];
    sminn[rt] = inf;
    return;
  }
  int mid = (L + R) >> 1;
  build(rt << 1, L, mid);
  build((rt << 1) + 1, mid + 1, R);
  pushup(rt);
}
void update1(int rt, int L, int R, int x) {
  if (minn[rt] >= x) return;
  if (sminn[rt] > x) {
    minn[rt] = x;
    lazy[rt] = x;
    return;
  }
  pushdown(rt);
  int mid = (L + R) >> 1;
  update1(rt << 1, L, mid, x);
  update1((rt << 1) + 1, mid + 1, R, x);
  pushup(rt);
}
void update2(int rt, int L, int R, int x, int y) {
  if (L == R) {
    minn[rt] = y;
    return;
  }
  pushdown(rt);
  int mid = (L + R) >> 1;
  if (x <= mid)
    update2(rt << 1, L, mid, x, y);
  else
    update2((rt << 1) + 1, mid + 1, R, x, y);
  pushup(rt);
}
int query(int rt, int L, int R, int x) {
  if (L == R) return minn[rt];
  int mid = (L + R) >> 1;
  pushdown(rt);
  if (x <= mid)
    return query(rt << 1, L, mid, x);
  else
    return query((rt << 1) + 1, mid + 1, R, x);
}
int main() {
  int n, q;
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  build(1, 1, n);
  q = read();
  while (q--) {
    int opt, x, y;
    opt = read();
    if (opt == 1) {
      x = read();
      y = read();
      update2(1, 1, n, x, y);
    } else {
      x = read();
      update1(1, 1, n, x);
    }
  }
  for (int i = 1; i <= n; i++) {
    write(query(1, 1, n, i));
    printf(" ");
  }
  puts("");
  return 0;
}
