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
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedInputStream;
import java.util.HashMap;
import java.util.ArrayList;
import java.io.FilterInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jenish
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DWelfareState solver = new DWelfareState();
        solver.solve(1, in, out);
        out.close();
    }

    static class DWelfareState {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int arr[] = new int[n];
            in.scanInt(arr);
            int p[] = new int[n];
            Arrays.fill(p, -1);
            HashMap<Integer, Integer> hmp = new HashMap<>();
            ArrayList<pair> xxx = new ArrayList<>();


            int q = in.scanInt();
            for (int j = 0; j < q; j++) {
                int t = in.scanInt();
                if (t == 1) {
                    int index = in.scanInt() - 1;
                    int bal = in.scanInt();
                    p[index] = j;
                    hmp.put(j, bal);
                } else {
                    int xx = in.scanInt();
                    xxx.add(new pair(xx, j));

                }
            }


            MaxSeg maxSeg = new MaxSeg(xxx.size());
            for (int i = 0; i < xxx.size(); i++) maxSeg.setMax(i, xxx.get(i).xx);
            for (int i = 0; i < n; i++) {
                if (p[i] == -1 && xxx.size() == 0) continue;
                if (p[i] != -1 && xxx.size() == 0) arr[i] = hmp.get(p[i]);
                if (p[i] == -1 && xxx.size() != 0) arr[i] = (int) Math.max(arr[i], maxSeg.max(0, xxx.size() - 1));

                if (p[i] != -1 && xxx.size() != 0) {
                    if (p[i] > xxx.get(xxx.size() - 1).index) {
                        arr[i] = hmp.get(p[i]);
                    } else {
                        arr[i] = hmp.get(p[i]);
                        int index = -1;
                        int l = 0;
                        int r = xxx.size() - 1;
                        while (l <= r) {
                            int mid = (l + r) / 2;
                            if (xxx.get(mid).index > p[i]) {
                                index = mid;
                                r = mid - 1;
                            } else {
                                l = mid + 1;
                            }
                        }
                        if (index == -1) throw new RuntimeException("SDAD");
                        arr[i] = (int) Math.max(arr[i], maxSeg.max(index, xxx.size() - 1));
                    }
                }
            }

            for (int i = 0; i < n; i++) {
                out.print(arr[i] + " ");
            }
        }

        class pair {
            int xx;
            int index;

            public pair(int xx, int index) {
                this.xx = xx;
                this.index = index;
            }

        }

    }

    static class MaxSeg {
        long[] tree;
        int n;

        public MaxSeg(int n) {
            this.n = n;
            tree = new long[2 * n];
            Arrays.fill(tree, Integer.MIN_VALUE);
        }

        public void setMax(int i, long value) {
            i += this.tree.length / 2;
            this.tree[i] = value;
            for (; i > 1; i >>= 1)
                this.tree[i >> 1] = Math.max(this.tree[i], this.tree[i ^ 1]);
        }

        public long max(int a, int b) {
            long res = Long.MIN_VALUE;
            for (a += this.tree.length / 2, b += this.tree.length / 2; a <= b; a = (a + 1) >> 1, b = (b - 1) >> 1) {
                res = Math.max(res, this.tree[a]);
                res = Math.max(res, this.tree[b]);
            }
            return res;
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public void scanInt(int[] A) {
            for (int i = 0; i < A.length; i++) A[i] = scanInt();
        }

    }
}

