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.*;
import java.util.*;
public class R576D {

	public static void main(String[] args) {
		JS scan = new JS();
		PrintWriter out = new PrintWriter(System.out);
		int n = scan.nextInt();
		int[] c = new int[n];
		for(int i = 0;i<n;i++){
			c[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		//when we get to each type 2 query, we need to know which citizens could've been screwed over just before
		//to see where they got screwed over
		TreeMap<Integer,Integer> map = new TreeMap<>();
		//to see what the highest compensation after they got screwed they can get is
		int[] highest = new int[q];
		ArrayList<event> arr = new ArrayList<>();
		for(int i = 0;i<q;i++){
			int a = scan.nextInt();
			if(a==1){
				int p = scan.nextInt();
				int x = scan.nextInt();
				map.put(p, i);
				c[p-1] = x;
			}else{
				int x = scan.nextInt();
				arr.add(new event(i,x));
			}
		}
		Collections.sort(arr);
		int best = 0;
		int last = -1;
		for(int i = arr.size()-1;i>=0;i--){
			event now = arr.get(i);
			for(int j = now.idx;j<last;j++){
				highest[j] = best;;
			}
			best = Math.max(best, now.x);
			//System.out.println(now.idx);
			highest[now.idx] = best;
			last = now.idx;
			//System.out.println(best);
		}
		for(int j =0;j<last;j++){
			highest[j] = best;;
		}
		for(int i = 1;i<=n;i++){
			//when might they have last gotten screwed over?
			if(!map.containsKey(i)){
				c[i-1] = Math.max(c[i-1], best);
			}else{
				int at = map.get(i);
				c[i-1] = Math.max(c[i-1], highest[at]);
			}
		}
		for(int i = 0;i<n;i++){
			out.print(c[i]+" ");
		}
		out.close();
		out.flush();

	}
	static class event implements Comparable<event>{
		int idx, x;
		public event(int idx1, int x1){
			idx = idx1;
			x = x1;
		}
		@Override
		public int compareTo(event arg0) {
			return idx-arg0.idx;
		}

	}
	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}				
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}

}
