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>
int arr[200001], lazy[800004];
std::pair<int, int> seg[800004];
class segtree {
 public:
  void build(int i, int s, int d);
  std::pair<int, int> merger(std::pair<int, int> left,
                             std::pair<int, int> right);
  void update1(int i, int s, int d, int p, int x);
  void update2(int i, int s, int d, int x);
  std::pair<int, int> query(int i, int s, int d, int qs, int qd);
};
void segtree::build(int i, int s, int d) {
  if (s == d) {
    seg[i] = std::make_pair(arr[s], arr[s]);
    lazy[i] = -1;
    return;
  }
  int m = (s + d) / 2;
  build(2 * i, s, m);
  build(2 * i + 1, m + 1, d);
  lazy[i] = -1;
  seg[i] = merger(seg[2 * i], seg[2 * i + 1]);
  return;
}
std::pair<int, int> segtree::merger(std::pair<int, int> left,
                                    std::pair<int, int> right) {
  return std::make_pair(std::min(left.first, right.first),
                        std::max(left.second, right.second));
}
std::pair<int, int> segtree::query(int i, int s, int d, int qs, int qd) {
  if (lazy[i] != -1) {
    seg[i] = std::make_pair(lazy[i], lazy[i]);
    if (s < d) {
      lazy[2 * i] = std::max(lazy[2 * i], lazy[i]);
      lazy[2 * i + 1] = std::max(lazy[2 * i + 1], lazy[i]);
    }
    lazy[i] = -1;
  }
  if (s > qd || d < qs)
    return std::make_pair(10000000001, -1);
  else if (qs <= s && d <= qd)
    return seg[i];
  int m = (s + d) / 2;
  std::pair<int, int> p1 = query(2 * i, s, m, qs, qd);
  std::pair<int, int> p2 = query(2 * i + 1, m + 1, d, qs, qd);
  return merger(p1, p2);
}
void segtree::update1(int i, int s, int d, int p, int x) {
  if (lazy[i] != -1) {
    seg[i] = std::make_pair(lazy[i], lazy[i]);
    if (s < d) {
      lazy[2 * i] = std::max(lazy[2 * i], lazy[i]);
      lazy[2 * i + 1] = std::max(lazy[2 * i + 1], lazy[i]);
    }
    lazy[i] = -1;
  }
  if (s == d) {
    seg[i] = std::make_pair(x, x);
    return;
  }
  int m = (s + d) / 2;
  if (p <= m)
    update1(2 * i, s, m, p, x);
  else
    update1(2 * i + 1, m + 1, d, p, x);
  seg[i] = merger(seg[2 * i], seg[2 * i + 1]);
  return;
}
void segtree::update2(int i, int s, int d, int x) {
  if (lazy[i] != -1) {
    seg[i] = std::make_pair(lazy[i], lazy[i]);
    if (s < d) {
      lazy[2 * i] = std::max(lazy[2 * i], lazy[i]);
      lazy[2 * i + 1] = std::max(lazy[2 * i + 1], lazy[i]);
    }
    lazy[i] = -1;
  }
  if (seg[i].first > x)
    return;
  else if (seg[i].second <= x) {
    seg[i] = std::make_pair(x, x);
    if (s < d) {
      lazy[2 * i] = std::max(lazy[2 * i], x);
      lazy[2 * i + 1] = std::max(lazy[2 * i + 1], x);
    }
    lazy[i] = -1;
    return;
  }
  int m = (s + d) / 2;
  update2(2 * i, s, m, x);
  update2(2 * i + 1, m + 1, d, x);
  seg[i] = merger(seg[2 * i], seg[2 * i + 1]);
  return;
}
int main(void) {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  int n, q;
  std::cin >> n;
  for (int i = 1; i <= n; i++) std::cin >> arr[i];
  std::cin >> q;
  segtree T;
  T.build(1, 1, n);
  while (q--) {
    int t;
    std::cin >> t;
    if (--t) {
      int x;
      std::cin >> x;
      T.update2(1, 1, n, x);
    } else {
      int p, x;
      std::cin >> p >> x;
      T.update1(1, 1, n, p, x);
    }
  }
  for (int i = 1; i <= n; i++) std::cout << T.query(1, 1, n, i, i).first << " ";
  std::cout << "\n";
  return 0;
}
