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.IOException;
import java.io.PrintWriter;
import java.util.*;

public class D {

	static FasterScanner sc = new FasterScanner();
	static PrintWriter out = new PrintWriter(System.out);

	static void exit() {
		out.close();
	}

	int [] A;
	int n;
	public D () {
		n = sc.nextInt();
		A = new int [n];
		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		int [] set_values = new int [n];
		int [] set_times = new int [n];
		for (int i = 0; i < n; i++) {
		    set_values[i] = A[i];
		    set_times[i] = 0;
		}
		int q = sc.nextInt();
		int [] reset_times = new int [q+2];
		int [] reset_values = new int [q+2];
		
		int reset_idx = 0;
		for (int i = 1; i <= q; i++) {
			int type = sc.nextInt();
			if (type == 2) {
				int x = sc.nextInt();
				reset_times[reset_idx] = i;
				reset_values[reset_idx] = x;
				reset_idx ++;
			} else {
				int p = sc.nextInt()-1, x = sc.nextInt();
				set_values[p] = x;
				set_times[p] = i;
			}
		}
		reset_times[reset_idx] = q+1;
		reset_values[reset_idx] = 0;
		reset_idx ++;
		int [] reset_max = new int [reset_idx];
		reset_max[reset_idx-1] = reset_values[reset_idx-1];
		for (int i = reset_idx-2; i >= 0; i --) {
		    reset_max[i] = Math.max(reset_max[i+1], reset_values[i]);
		}
//		out.println(Arrays.toString(set_values));
//		out.println(Arrays.toString(set_times));
//		out.println(Arrays.toString(reset_values));
//		out.println(Arrays.toString(reset_times));
//		out.println(Arrays.toString(reset_max));
		for (int i = 0; i < n; i++) {
		    int set_time = set_times[i];
		    int p = Arrays.binarySearch(reset_times, 0, reset_idx, set_time);
//		    out.println("p="+p);
		    // p should be smaller than 0
		    p = - (p+1);
            int max_reset = reset_max[p];
            if (max_reset > set_values[i]) A[i] = max_reset;
            else A[i] = set_values[i];
            
		}
		for (int i = 0; i < n; i++) {
		    out.print(A[i] + " ");
		}
		out.println();

		
	}

	public static void main(String[] args) {
		new D();
		exit();
	}

	static class FasterScanner {
        private byte[] buf = new byte[1024];
        private int curChar;
        private int snumChars;

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = System.in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n, int f) {
            if (f == 0) {
                int[] arr = new int[n];
                for (int i = 0; i < n; i++) {
                    arr[i] = nextInt();
                }
                return arr;
            } else {
                int[] arr = new int[n + 1];
                for (int i = 1; i < n + 1; i++) {
                    arr[i] = nextInt();
                }
                return arr;
            }
        }

        public long[] nextLongArray(int n, int f) {
            if (f == 0) {
                long[] arr = new long[n];
                for (int i = 0; i < n; i++) {
                    arr[i] = nextLong();
                }
                return arr;
            } else {
                long[] arr = new long[n + 1];
                for (int i = 1; i < n + 1; i++) {
                    arr[i] = nextLong();
                }
                return arr;
            }
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
    }
}