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 \le n \le 2 \cdot 10^{5}$) — the numer of citizens.

The next line contains $n$ integers $a_1$, $a_2$, ..., $a_n$ ($0 \le a_{i} \le 10^{9}$) — the initial balances of citizens.

The next line contains a single integer $q$ ($1 \le q \le 2 \cdot 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 \le p \le n$, $0 \le x \le 10^{9}$), or 2 x ($0 \le x \le 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 $\rightarrow$ 3 3 3 4 $\rightarrow$ 3 2 3 4 $\rightarrow$ 3 2 3 4

In the second example the balances change as follows: 3 50 2 1 10 $\rightarrow$ 3 0 2 1 10 $\rightarrow$ 8 8 8 8 10 $\rightarrow$ 8 8 20 8 10

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Sorting

Data structures

Complete search


Solutions:
n = int(input())
a = list(map(int, input().split()))
last_updated = [0 for _ in range(n)]
q = int(input())
pay_days = [0 for _ in range(q)]
for i in range(q):
	qu = list(map(int, input().split()))
	if qu[0] == 1:
		(_, p, x) = qu
		a[p - 1] = x
		last_updated[p - 1] = i
	else:
		(_, x) = qu
		pay_days[i] = x
for i in range(q - 1):
	pay_days[q - i - 2] = max(pay_days[q - i - 1], pay_days[q - i - 2])
for i in range(n):
	print(max(a[i], pay_days[last_updated[i]]), end=' ')
print()


import sys
n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))
q = int(sys.stdin.readline())
qu = [tuple(map(int, sys.stdin.readline().split())) for _ in range(q)]
an = [-1] * n
m = 0
for i in range(q):
	query = qu[q - i - 1]
	if query[0] == 2:
		m = max(m, query[1])
	elif an[query[1] - 1] == -1:
		an[query[1] - 1] = max(query[2], m)
for i in range(n):
	if an[i] == -1:
		print(max(m, a[i]), end=' ')
	else:
		print(an[i], end=' ')
print()


n = int(input())
money = list(map(int, input().split()))
q = int(input())
tranzactions = list((list(map(int, input().split())) for _ in range(q)))
result = [-1] * n
temp = -1
for i in range(q - 1, -1, -1):
	if tranzactions[i][0] == 1:
		if result[tranzactions[i][1] - 1] == -1:
			result[tranzactions[i][1] - 1] = max(tranzactions[i][2], temp)
	else:
		temp = max(tranzactions[i][1], temp)
for i in range(n):
	if result[i] == -1:
		result[i] = max(temp, money[i])
print(' '.join(map(str, result)))


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
q = int(input())
a2 = [-1] * len(a)
arr = [None] * q
pay = [-1] * q
for i in range(q):
	b = input().split()
	if len(b) == 2:
		pay[i] = int(b[1])
	else:
		arr[i] = int(b[1])
		a2[arr[i] - 1] = int(b[2])
pay_max = max(pay)
pay_maxi = q - pay[::-1].index(pay_max) - 1
a = [pay_max if x < pay_max else x for x in a]
m = [0] * q
ma = -1
for i in range(q - 1, -1, -1):
	if pay[i] != -1:
		ma = max(ma, pay[i])
	m[i] = ma
for i in range(q):
	if arr[i]:
		if i > pay_maxi:
			a[arr[i] - 1] = max(a2[arr[i] - 1], m[i])
		else:
			a[arr[i] - 1] = max(a2[arr[i] - 1], pay_max)
print(*a)


import sys
in_file = sys.stdin
n = int(in_file.readline().strip())
a = list(map(int, in_file.readline().strip().split()))
q = int(in_file.readline().strip())
ls = [list(map(int, in_file.readline().strip().split())) for _ in range(q)]
mxs = [-1] * q
mxs[-1] = ls[-1][1] if ls[-1][0] == 2 else -1
for i in range(q - 2, -1, -1):
	mxs[i] = max(mxs[i + 1], ls[i][1] if ls[i][0] == 2 else -1)
o = [max(mxs[0], x) for x in a]
for i in range(q):
	if ls[i][0] != 1:
		continue
	(p, x) = ls[i][1:]
	o[p - 1] = max(x, mxs[i])
sys.stdout.write(' '.join(map(str, o)))
sys.stdout.flush()


import sys
import bisect
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
q = int(input())
x = []
t = []
for i in range(q):
	inp = list(map(int, input().split()))
	if len(inp) == 2:
		x.append(inp[1])
		t.append(i)
	else:
		(p, z) = inp[1:]
		p -= 1
		b[p] = i
		a[p] = z
if len(x) > 1:
	for i in range(len(x) - 2, -1, -1):
		x[i] = max(x[i], x[i + 1])
for i in range(n):
	idx = bisect.bisect_left(t, b[i])
	if idx < len(x):
		print(max(a[i], x[idx]), end=' ')
	else:
		print(a[i], end=' ')
print()


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
(q,) = I()
ar = [-1] * n
tm = 0
qr = []
for i in range(q):
	qr.append(I())
for i in range(q - 1, -1, -1):
	r = qr[i]
	if r[0] == 1:
		if ar[r[1] - 1] == -1:
			ar[r[1] - 1] = max(r[2], tm)
	else:
		tm = max(tm, r[1])
for i in range(n):
	l[i] = max(tm, l[i]) if ar[i] == -1 else ar[i]
	print(l[i], end=' ')


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import log2, ceil
from bisect import bisect_right as br, bisect_left as bl
(n,) = I()
l = I()
(q,) = I()
p = 0
t = []
while q:
	q -= 1
	t.append(I())
mx = 0
ans = [-1] * n
for i in t[::-1]:
	if i[0] == 1:
		i[1] -= 1
		if ans[i[1]] == -1:
			ans[i[1]] = max(mx, i[2])
	else:
		mx = max(mx, i[1])
for i in range(n):
	if ans[i] == -1:
		ans[i] = max(mx, l[i])
print(*ans)


def main():
	n = int(input())
	money = list(map(int, input().split()))
	last_change = [-1] * n
	dp = []
	q = int(input())
	second = []
	for i in range(q):
		query = list(map(int, input().split()))
		if query[0] == 1:
			dp.append(-1)
			(p, x) = (query[1], query[2])
			money[p - 1] = x
			last_change[p - 1] = i
		else:
			second.append(query[1])
			dp.append(query[1])
	for i in range(len(dp) - 2, -1, -1):
		dp[i] = max(dp[i + 1], dp[i])
	for i in range(n):
		if last_change[i] == -1:
			money[i] = max(dp[0], money[i])
		else:
			change = last_change[i]
			if change + 1 < len(dp):
				max_val = dp[change + 1]
			else:
				max_val = -1
			money[i] = max(max_val, money[i])
	for i in money:
		print(i, end=' ')
main()


import sys
input = sys.stdin.readline
n = int(input())
ar = list(map(int, input().split()))
q = int(input())
op = [-1] * n
m = 0
pp = []
for i in range(q):
	pp.append(list(map(int, input().split())))
for i in range(q - 1, -1, -1):
	if pp[i][0] == 2:
		m = max(m, pp[i][1])
	elif op[pp[i][1] - 1] == -1:
		op[pp[i][1] - 1] = max(pp[i][2], m)
for i in range(n):
	if op[i] == -1:
		op[i] = max(ar[i], m)
print(*op)


n = int(input())
a = list(map(int, input().split()))
q = int(input())
last_set = [0] * n
alles = [0]
for i in range(q):
	r = list(map(int, input().split()))
	if len(r) == 2:
		alles.append(r[1])
	else:
		last_set[r[1] - 1] = len(alles)
		a[r[1] - 1] = r[2]
maxis = alles
i = len(maxis) - 1
prev_max = 0
while i >= 0:
	prev_max = max(prev_max, alles[i])
	maxis[i] = prev_max
	i -= 1
for i in range(n):
	if last_set[i] < len(maxis):
		a[i] = max(a[i], maxis[last_set[i]])
print(' '.join(map(str, a)))


import bisect
import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
q = int(input())
dp = []
ind = []
ap = [0] * q
for i in range(q):
	s = list(map(int, input().split()))
	if s[0] == 1:
		ind.append([i, s[1], s[2]])
	else:
		ap[i] = s[1]
for i in range(q - 2, -1, -1):
	ap[i] = max(ap[i + 1], ap[i])
mx = max(ap)
for i in range(n):
	if a[i] < mx:
		a[i] = mx
for i in ind:
	if ap[i[0]] > i[2]:
		a[i[1] - 1] = ap[i[0]]
	else:
		a[i[1] - 1] = i[2]
print(*a)


import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
q = int(input())
query = [list(map(int, input().split())) + [i] for i in range(q)]
q1 = []
q2 = [0] * q
for qu in query:
	if qu[0] == 1:
		q1.append(qu[1:])
	else:
		q2[qu[-1]] = qu[1]
MAXQ = [0] * q
MAXQ[q - 1] = q2[q - 1]
for i in range(q - 2, -1, -1):
	MAXQ[i] = max(MAXQ[i + 1], q2[i])
B = [(a, 0) for a in A]
for (x, y, ind) in q1:
	B[x - 1] = (y, ind)
ANS = [0] * n
for i in range(n):
	(m, ind) = B[i]
	ANS[i] = max(m, MAXQ[ind])
print(*ANS)


import os
import sys
from io import BytesIO, IOBase
from collections import deque
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def getint():
	return int(input())

def getints():
	return list(map(int, input().split()))

def getint1():
	return list(map(lambda x: int(x) - 1, input().split()))

def main():
	n = getint()
	a = getints()
	type1 = [-1] * n
	type2 = deque()
	q = getint()
	for i in range(q):
		l = getints()
		if l[0] == 1:
			(pid, x) = (l[1], l[2])
			a[pid - 1] = x
			type1[pid - 1] = i
			type2.append(0)
		else:
			type2.append(l[1])
	temp = type2[-1]
	type2[-1] = 0
	for i in range(q - 2, -1, -1):
		temp1 = type2[i]
		type2[i] = max(temp, type2[i + 1])
		temp = temp1
	type2.appendleft(max(temp, type2[0]))
	for i in range(n):
		a[i] = max(a[i], type2[type1[i] + 1])
	print(*a)
main()


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
n = inp()
arr = seq()
q = inp()
last = [-1] * n
quer = [-1] * (q + 1)
for i in range(q):
	s = list(input().strip().split(' '))
	if len(s) == 3:
		p = int(s[1]) - 1
		qr = int(s[2])
		arr[p] = qr
		last[p] = i
	else:
		x = int(s[1])
		quer[i] = x
for i in range(q - 1, -1, -1):
	quer[i] = max(quer[i], quer[i + 1])
for i in range(n):
	arr[i] = max(arr[i], quer[last[i] + 1])
print(' '.join(map(str, arr)))


n = int(input())
a = list(map(int, input().split()))
q = int(input())
qu = list()
an = [-1] * n
m = 0
for i in range(q):
	qu.append(tuple(map(int, input().split())))
for i in range(q):
	k = qu[q - i - 1]
	if k[0] == 2:
		m = max(m, k[1])
	elif an[k[1] - 1] == -1:
		an[k[1] - 1] = max(m, k[2])
for i in range(n):
	if an[i] == -1:
		an[i] = max(m, a[i])
print(*an)


R = lambda : map(int, input().split())
n = int(input())
a = (*zip([1] * n, range(1, n + 1), R()), *([*R()] for _ in [0] * int(input())))
r = [-1] * n
m = 0
for (t, p, *x) in a[::-1]:
	if t > 1:
		m = max(m, p)
	elif r[p - 1] < 0:
		r[p - 1] = max(x[0], m)
print(*r)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		n = ri()
		a = ria()
		q = ri()
		m = 0
		d = {}
		occ = {}
		queries = []
		gg = []
		for i in range(q):
			query = ria()
			queries.append(query)
			g = 0
			if query[0] == 2:
				x = query[1]
				m = max(x, m)
				g = x
			else:
				(p, x) = (query[1], query[2])
				a[p - 1] = x
				occ[p - 1] = i
				d[p - 1] = 1
			gg.append(g)
		ans = [0] * n
		mfb = [0] * q
		e = 0
		for i in range(q - 1, -1, -1):
			e = max(e, gg[i])
			mfb[i] = e
		for i in range(n):
			if i not in d:
				ans[i] = max(a[i], m)
			else:
				ans[i] = max(a[i], mfb[occ[i]])
		print(*ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


INF = 10 ** 12
n = int(input())
a = [int(item) for item in input().split()]
min_recipt = [INF] * n
q = int(input())
max_payoff = 0
query = []
for i in range(q):
	query.append([int(item) for item in input().split()])
ans = [-1] * n
for que in query[::-1]:
	if que[0] == 1:
		if ans[que[1] - 1] != -1:
			continue
		ans[que[1] - 1] = max(max_payoff, que[2])
	elif que[0] == 2:
		max_payoff = max(max_payoff, que[1])
for (i, (val, item)) in enumerate(zip(a, ans)):
	if item != -1:
		continue
	ans[i] = max(max_payoff, val)
print(' '.join([str(item) for item in ans]))


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
n = int(input())
l = list(map(int, input().split()))
q = int(input())
query = []
for i in range(q):
	l1 = list(map(int, input().split()))
	if len(l1) == 2:
		(a, b) = l1
		query.append([a, b])
	else:
		(a, b, c) = l1
		query.append([a, b, c])
query.reverse()
maxi = 0
seti = set()
for (i, j) in enumerate(query):
	if len(query[i]) == 2:
		(a, b) = query[i]
		maxi = max(maxi, b)
	else:
		(a, b, c) = query[i]
		if b - 1 not in seti:
			l[b - 1] = max(maxi, c)
			seti.add(b - 1)
for i in range(n):
	if i not in seti:
		l[i] = max(l[i], maxi)
print(*l)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
l = list(map(int, input().split()))
q = int(input())
dp = [0] * (q + 1)
inp = []
last = [0] * n
for i in range(q):
	inp.append(list(map(int, input().split())))
	if inp[i][0] == 1:
		last[inp[i][1] - 1] = i
		l[inp[i][1] - 1] = inp[i][2]
for i in range(q - 1, -1, -1):
	if inp[i][0] == 2:
		dp[i] = max(dp[i + 1], inp[i][1])
	else:
		dp[i] = dp[i + 1]
for i in range(n):
	val = dp[last[i]]
	l[i] = max(l[i], val)
print(*l, sep=' ')


import os
import sys
import string
import math

def main(balances, events):
	payouts = [0] * len(events)
	last_change = [0] * len(balances)
	for i in range(len(events)):
		if events[i][0] == 1:
			(_, index, value) = events[i]
			index -= 1
			last_change[index] = i
			balances[index] = value
		elif events[i][0] == 2:
			payouts[i] = events[i][1]
	for i in range(len(events) - 2, -1, -1):
		payouts[i] = max(payouts[i], payouts[i + 1])
	for i in range(len(balances)):
		yield max(balances[i], payouts[last_change[i]])

def parse():
	n = int(input())
	balances = [int(s) for s in input().split(' ')]
	event_count = int(input())
	events = []
	for line in sys.stdin:
		if len(events) < event_count:
			events.append([int(s) for s in line.split(' ')])
	return (balances, events)

def output(ans):
	print(' '.join([str(i) for i in ans]))
output(main(*parse()))


from sys import stdin
input = stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
q = int(input())
payoff = [0] * q
a_receipt = [0] * n
for _ in range(q):
	pay = [int(i) for i in input().split()]
	if pay[0] == 1:
		a[pay[1] - 1] = pay[2]
		a_receipt[pay[1] - 1] = _
	else:
		payoff[_] = pay[1]
max_payoff = 0
for i in range(q):
	max_payoff = max([max_payoff, payoff[q - i - 1]])
	payoff[q - i - 1] = max_payoff
for i in range(n):
	print(max([a[i], payoff[a_receipt[i]]]), end=' ')


n = int(input())
balance = list(map(int, input().split()))
q = int(input())
log = [list(map(int, input().split())) for i in range(q)]
ind_of_last_operation = [None] * n
max_pay = 0
ind_of_max_payment = None
payments = []
payments_id = []
for i in range(q):
	if log[i][0] == 1:
		ind_of_last_operation[log[i][1] - 1] = i
for i in range(q):
	if log[i][0] == 2:
		ind_of_last_payment = i
		last_payment = log[i][1]
		if log[i][1] > max_pay:
			max_pay = log[i][1]
max_pay_for_moment = [0] * (q + 1)
for j in range(q - 1, -1, -1):
	if log[j][0] == 2:
		max_pay_for_moment[j] = max(log[j][1], max_pay_for_moment[j + 1])
	else:
		max_pay_for_moment[j] = max_pay_for_moment[j + 1]
for i in range(n):
	if ind_of_last_operation[i] == None:
		if balance[i] < max_pay:
			balance[i] = max_pay
	elif max_pay_for_moment[ind_of_last_operation[i] + 1] > log[ind_of_last_operation[i]][2]:
		balance[i] = max_pay_for_moment[ind_of_last_operation[i] + 1]
	else:
		balance[i] = log[ind_of_last_operation[i]][2]
print(*balance)


from sys import stdin
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	a[i] = [a[i], 0]
(was, change) = (0, [])
q = int(input())
for _ in range(q):
	l = list(map(int, input().split()))
	if l[0] == 1:
		a[l[1] - 1] = [l[2], was]
	else:
		change.append(l[1])
		was += 1
arr = [-1]
for i in range(len(change) - 1, -1, -1):
	arr.append(max(arr[-1], change[i]))
arr = arr[::-1]
print(*[max(v[0], arr[v[1]]) for v in a])


n = int(input())
a = list(map(int, input().split()))
b = [-1] * n
q = int(input())
qs = list()
for _ in range(q):
	qs.append(list(map(int, input().split())))
maxx = -1
for i in range(q - 1, -1, -1):
	if qs[i][0] == 1:
		p = qs[i][1] - 1
		if b[p] == -1:
			a[p] = max(maxx, qs[i][2])
			b[p] = 1
	else:
		maxx = max(maxx, qs[i][1])
for i in range(n):
	if b[i] == -1:
		print(max(maxx, a[i]), end=' ')
	else:
		print(a[i], end=' ')


from sys import stdin, stdout
N = int(input())
arr = [int(x) for x in stdin.readline().split()]
Q = int(input())
logg = [0] * Q
t = [0] * Q
account = [0] * Q
m = [0] * Q
valid = [1] * Q
for i in range(Q):
	a = [int(x) for x in stdin.readline().split()]
	if a[0] == 1:
		account[i] = a[1]
		t[i] = 1
		logg[i] = a[2]
	else:
		logg[i] = a[1]
		t[i] = 2
maxi = -1
for i in range(Q - 1, -1, -1):
	if t[i] == 2:
		maxi = max(maxi, logg[i])
	m[i] = maxi
for i in range(Q):
	if logg[i] < m[i]:
		valid[i] = 0
for i in range(N):
	if arr[i] < maxi:
		arr[i] = maxi
for i in range(Q):
	if valid[i] == 1 and t[i] == 1:
		arr[account[i] - 1] = logg[i]
	elif valid[i] == 0 and t[i] == 1:
		arr[account[i] - 1] = m[i]
print(*arr)


import math, sys, bisect, heapq, os
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
from functools import lru_cache
pr = lambda x: x

def input():
	return sys.stdin.readline().rstrip('\r\n')
aj = lambda : list(map(int, input().split()))

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])

def solve():
	(n,) = aj()
	A = aj()
	B = []
	(q,) = aj()
	G = {}
	q2 = []
	for i in range(q):
		v = aj()
		B.append(v)
		if v[0] == 2:
			q2.append([i, v[1]])
		else:
			G[v[1] - 1] = (i, v[2])
	q2 += [[1000000000.0, 0]]
	for i in range(len(q2) - 2, -1, -1):
		q2[i][1] = max(q2[i][1], q2[i + 1][1])
	maxi = q2[0][1]
	for (ii, i) in enumerate(A):
		(x, y) = G.get(ii, [-1, -1])
		if x == -1:
			A[ii] = max(i, maxi)
		else:
			v = bisect.bisect_left(q2, [x + 1, 0])
			(u, vv) = q2[v]
			A[ii] = max(y, vv)
	print(*A)
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	from aj import *
except:
	pass
solve()


from sys import stdin, stdout
from math import gcd, sqrt, inf
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
M = inf
n = I()
(*a,) = R()
cng = [-1] * n
q = I()
op = [0] * (q + 1)
for i in range(q):
	(*p,) = R()
	if p[0] == 2:
		op[i] = p[1]
	else:
		cng[p[1] - 1] = i
		a[p[1] - 1] = p[2]
x = 0
for i in range(q, -1, -1):
	x = max(x, op[i])
	op[i] = x
print(*[max(a[i], op[cng[i] + 1]) for i in range(n)])


n = int(input())
l = [int(i) for i in input().split()]
q = int(input())
t = [-1] * n
upd = [0] * q
for i in range(q):
	k = [int(x) for x in input().split()]
	if k[0] == 1:
		l[k[1] - 1] = k[2]
		t[k[1] - 1] = i
	else:
		upd[i] = k[1]
for i in range(q - 2, -1, -1):
	upd[i] = max(upd[i], upd[i + 1])
for i in range(n):
	if i < n and t[i] + 1 < q:
		l[i] = max(l[i], upd[t[i] + 1])
print(*l)


import sys
from collections import defaultdict as dd
pl = 1
from math import *
import copy
if pl:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(xxx) for xxx in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())
d = []
from bisect import *
from itertools import permutations
from bisect import *
n = fi()
a = li()
q = fi()
for i in range(n):
	d.append([1, i + 1, a[i]])
for i in range(q):
	p = li()
	d.append(p)
d = d[::-1]
f = [0 for i in range(n)]
flag = [0 for i in range(n)]
p = 0
for i in range(q + n):
	if len(d[i]) == 2:
		p = max(p, d[i][1])
	else:
		if flag[d[i][1] - 1] == 1:
			continue
		if p >= d[i][2]:
			f[d[i][1] - 1] = p
		else:
			f[d[i][1] - 1] = d[i][2]
		flag[d[i][1] - 1] = 1
print(*f)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import collections as col
import math

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	N = getInt()
	A = getInts()
	Q = getInt()
	last_1 = col.defaultdict(tuple)
	for n in range(N):
		last_1[n] = (A[n], -1)
	type2s = [0 for q in range(Q)]
	for q in range(Q):
		S = getStrs()
		if S[0] == '1':
			(P, X) = (int(S[1]), int(S[2]))
			last_1[P - 1] = (X, q)
		else:
			X = int(S[1])
			type2s[q] = X
	curr_max = 0
	maxQ = [0 for q in range(Q + 1)]
	for q in range(Q - 1, -1, -1):
		curr_max = max(type2s[q], curr_max)
		maxQ[q] = curr_max
	ans = []
	for n in range(N):
		(val, idx) = last_1[n]
		ans.append(max(val, maxQ[idx + 1]))
	print(*ans)
	return
solve()


from sys import stdin as cin, stdout as cout
get = cin.readline
end = cout.flush

def put(x):
	cout.write(str(x))
input = cout.readline
n = int(get())
ar = list(map(int, get().split()))
q = int(get())
p = []
for i in range(q):
	x = tuple(map(int, get().split()))
	p.append(x)
mod = [0] * n
cur_max = -1
p = p[::-1]
for i in p:
	if i[0] == 1:
		if mod[i[1] - 1] == 0:
			ar[i[1] - 1] = max(cur_max, i[2])
			mod[i[1] - 1] = 1
	else:
		cur_max = max(cur_max, i[1])
for i in range(n):
	if mod[i] == 0:
		ar[i] = max(ar[i], cur_max)
put(' '.join((str(i) for i in ar)))
end()


from sys import stdin
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
q = int(input())
last = [0] * (n + 1)
up = [0] * (q + 1)
for i in range(1, q + 1):
	k = list(map(int, input().split()))
	if k[0] == 1:
		a[k[1] - 1] = k[2]
		last[k[1] - 1] = i
	else:
		up[i] = k[1]
for i in range(q - 1, -1, -1):
	up[i] = max(up[i], up[i + 1])
for i in range(n):
	a[i] = max(a[i], up[last[i]])
print(*a)


import sys
n = int(sys.stdin.readline())
data = [int(i) for i in sys.stdin.readline().split()]
q = int(sys.stdin.readline())
welfare = [0] * (q + 1)
tw = []
changes = [(0, 0)] + [(0, a) for a in data]
for i in range(1, q + 1):
	qu = [int(i) for i in sys.stdin.readline().split()]
	if qu[0] == 1:
		changes[qu[1]] = (i, qu[2])
	else:
		tw.append((i, qu[1]))
ind = len(tw) - 1
maxw = -1
time = q + 1
while ind >= 0:
	welf = tw[ind]
	for i in range(welf[0], time):
		welfare[i] = maxw
	time = welf[0]
	if welf[1] > maxw:
		maxw = welf[1]
	ind -= 1
for i in range(time):
	welfare[i] = maxw
ans = []
for i in range(1, n + 1):
	lastch = changes[i]
	if welfare[lastch[0]] > lastch[1]:
		ans.append(str(welfare[lastch[0]]))
	else:
		ans.append(str(lastch[1]))
sys.stdout.write(' '.join(ans) + '\n')


from sys import stdin
input = stdin.readline
n = int(input())
arr = list(map(lambda o: (o, 0), map(int, input().split())))
q = int(input())
parr = []
for i in range(q):
	e = input().split()
	if e[0] == '1':
		arr[int(e[1]) - 1] = (int(e[2]), i)
	else:
		parr.append((i, int(e[1])))
tarr = [0] * q
pi = len(parr) - 1
hsf = 0
for i in reversed(range(q)):
	if pi > -1 and parr[pi][0] == i:
		hsf = max(hsf, parr[pi][1])
		pi -= 1
	tarr[i] = hsf
print(*map(lambda o: max(o[0], tarr[o[1]]), arr))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
l = list(map(int, input().split()))
from bisect import bisect
q = int(input())
l1 = []
b = q
c = 0
d = 0
l2 = [-1] * n
l3 = [-1] * n
l4 = []
l5 = []
a = 0
for i in range(q):
	ll = list(map(int, input().split()))
	if ll[0] == 1:
		l2[ll[1] - 1] = ll[2]
		l3[ll[1] - 1] = i
	else:
		l4.append(ll[1])
		l5.append(i)
l6 = [-1] * len(l5)
a = 0
for i in range(len(l5) - 1, -1, -1):
	a = max(a, l4[i])
	l6[i] = a
for i in range(n):
	if l2[i] == -1:
		l[i] = max(l[i], a)
	else:
		x = bisect(l5, l3[i])
		if x != len(l5):
			l[i] = max(l2[i], l6[x])
		else:
			l[i] = l2[i]
print(*l)


(n, a, q) = (int(input()), [*list(map(int, input().split()))], int(input()))
ops = []
for i in range(q):
	(t, *b) = list(map(int, input().split()))
	ops.append((t, b))
b = [-1] * n
m = -1
for (op, ar) in reversed(ops):
	if op == 2:
		m = max(m, ar[0])
	else:
		(p, x) = ar
		p -= 1
		if b[p] == -1:
			b[p] = max(x, m)
print(' '.join((str(bi if bi != -1 else max(m, ai)) for (ai, bi) in zip(a, b))))


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
nb = RI()
have = RMI()
nb_ops = RI()
curr = [-1] * nb
maxs = 0
ops = [RMI() for _ in range(nb_ops)][::-1]
for i in ops:
	if i[0] == 2:
		maxs = max(maxs, i[1])
	elif curr[i[1] - 1] == -1:
		curr[i[1] - 1] = max(maxs, i[2])
for i in range(nb):
	if curr[i] == -1:
		curr[i] = max(maxs, have[i])
print(*curr)


n = int(input())
sp = list(map(int, input().split()))
m = int(input())
pos = [-1] * (n + 1)
m1 = 0
mem = []
for i in range(m):
	sp1 = list(map(int, input().split()))
	mem.append(sp1)
	if sp1[0] == 1:
		sp[sp1[1] - 1] = sp1[2]
		pos[sp1[1] - 1] = i
	else:
		m1 = max(m1, sp1[1])
maxs = [-1] * (m + 1)
for i in range(m - 1, -1, -1):
	sp1 = mem[i]
	if sp1[0] == 2:
		if i == m - 1 or sp1[1] > maxs[i + 1]:
			maxs[i] = sp1[1]
		else:
			maxs[i] = maxs[i + 1]
	else:
		maxs[i] = maxs[i + 1]
for i in range(n):
	if pos[i] != -1 and sp[i] < maxs[pos[i]]:
		sp[i] = maxs[pos[i]]
	elif pos[i] == -1:
		sp[i] = max(sp[i], maxs[0])
print(*sp)


import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int, input().split()))
lUpd = [0] * n
q = int(input())
payoff = [-1] * q
for query in range(q):
	qnext = list(map(int, input().split()))
	if qnext[0] == 1:
		p = qnext[1] - 1
		x = qnext[2]
		l[p] = x
		lUpd[p] = query
	else:
		x = qnext[1]
		payoff[query] = x
maxPayoff = [-1] * q
best = -1
for i in range(q - 1, -1, -1):
	best = max(best, payoff[i])
	maxPayoff[i] = best
out = [max(l[p], maxPayoff[lUpd[p]]) for p in range(n)]
print(' '.join(map(str, out)))


import sys
input = sys.stdin.readline

class SegmentTree:

	def __init__(self, n):
		self.size = 1
		while self.size < n:
			self.size *= 2
		self.node = [0] * (2 * self.size - 1)

	def update(self, i, val):
		i += self.size - 1
		self.node[i] = val
		while i > 0:
			i = (i - 1) // 2
			self.node[i] = max(self.node[2 * i + 1], self.node[2 * i + 2])

	def get_max(self, begin, end):
		begin += self.size - 1
		end += self.size - 1
		s = 0
		while begin < end:
			if end - 1 & 1:
				end -= 1
				s = max(s, self.node[end])
			if begin - 1 & 1:
				s = max(s, self.node[begin])
				begin += 1
			begin = (begin - 1) // 2
			end = (end - 1) // 2
		return s
n = int(input())
a = list(map(int, input().split()))
q = int(input())
info = [list(map(int, input().split())) for i in range(q)]
st = SegmentTree(q)
li = [0] * n
for i in range(q):
	if info[i][0] == 1:
		ind = info[i][1] - 1
		a[ind] = info[i][2]
		li[ind] = i
	else:
		st.update(i, info[i][1])
ans = [0] * n
for i in range(n):
	tmp = max(st.get_max(li[i], q), a[i])
	ans[i] = tmp
print(' '.join(map(str, ans)))


n = int(input())
a = [int(x) for x in input().split()]
t = q = int(input())
maxarr = [-1] * n
maxGlob = -1
quer = []
while t > 0:
	quer.append(tuple(map(int, input().split())))
	t -= 1
for i in range(q - 1, -1, -1):
	k = quer[i]
	if k[0] == 2:
		maxGlob = max(maxGlob, k[1])
	elif maxarr[k[1] - 1] == -1:
		maxarr[k[1] - 1] = max(k[2], maxGlob)
for i in range(n):
	if maxarr[i] == -1:
		maxarr[i] = max(maxGlob, a[i])
print(*maxarr)


import sys

class DWelfareState:

	def solve(self):
		n = int(input())
		a = [int(_) for _ in input().split()]
		q = int(input())
		queries = []
		v = [[-1, a[i]] for i in range(n)]
		x_max = [-float('inf')] * (q + 1)
		for qi in range(q):
			query = [int(_) for _ in input().split()]
			queries.append(query)
			type = query[0]
			if type == 1:
				(i, x) = query[1:]
				i -= 1
				v[i] = [qi, x]
			else:
				x = query[1]
				x_max[qi] = max(x_max[qi - 1], x)
		suff = [0] * (q + 1)
		suff[-1] = -float('inf')
		for i in range(q - 1, -1, -1):
			suff[i] = max(suff[i + 1], x_max[i])
		ans = [0] * n
		for i in range(n):
			ans[i] = max(suff[v[i][0] + 1], v[i][1])
		print(*ans)
solver = DWelfareState()
input = sys.stdin.readline
solver.solve()


import sys
input = sys.stdin.readline
n = int(input())
li = list(map(int, input().split()))
check = [-1] * n
maxx = 0
for i in [input().split() for i in range(int(input()))][::-1]:
	if i[0] == '2':
		maxx = max(maxx, int(i[1]))
	elif check[int(i[1]) - 1] == -1:
		check[int(i[1]) - 1] = max(int(i[2]), maxx)
for i in range(n):
	if check[i] == -1:
		check[i] = max(maxx, li[i])
print(*check)


from sys import stdin
from sys import setrecursionlimit as SRL
SRL(10 ** 7)
rd = stdin.readline
rrd = lambda : map(int, rd().strip().split())
n = int(input())
a = list(rrd())
op = []
q = int(input())
for i in range(q):
	c = list(rrd())
	op.append(c)
sure = [-1] * (n + 1)
hi = 0
for i in range(q - 1, -1, -1):
	if op[i][0] == 1:
		cnt = op[i][1]
		if sure[cnt] is -1:
			sure[cnt] = max(op[i][2], hi)
	else:
		hi = max(hi, op[i][1])
for i in range(1, n + 1):
	if sure[i] is -1:
		sure[i] = max(hi, a[i - 1])
	print(sure[i])


import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int, input().split()))
q = int(input())
qq = []
ql = []
li = []
for i in range(n):
	li.append(i)
for i in range(q):
	a = list(map(int, input().split()))
	qq.append(a)
	if a[0] == 2:
		ql.append((a[1], i))
ql.sort(reverse=True)
ll = []
ind = -1
for i in ql:
	(val, indx) = i
	if indx > ind:
		ll.append((indx, val))
		ind = indx
cur = 0
first = 0
indx = 0
for i in qq:
	if i[0] == 1:
		l[i[1] - 1] = i[2]
		if first:
			li.append(i[1] - 1)
	else:
		(typ, ind) = i
		if cur < len(ll) and indx == ll[cur][0]:
			for j in li:
				if l[j] < ll[cur][1]:
					l[j] = ll[cur][1]
			cur += 1
			li = []
			first = 1
	indx += 1
print(*l)


import sys
input = sys.stdin.readline
from bisect import *
n = int(input())
a = list(map(int, input().split()))
last = [-1] * n
q = int(input())
two_que_t = []
two_que_v = []
for t in range(q):
	que = tuple(map(int, input().split()))
	if len(que) == 3:
		(p, x) = (que[1], que[2])
		a[p - 1] = x
		last[p - 1] = t
	else:
		two_que_t.append(t)
		two_que_v.append(que[1])
acc_max = []
for i in range(len(two_que_v) - 1, -1, -1):
	if i == len(two_que_v) - 1:
		acc_max.append(two_que_v[i])
	else:
		acc_max.append(max(acc_max[-1], two_que_v[i]))
acc_max = acc_max[::-1]
for i in range(n):
	idx = bisect_right(two_que_t, last[i])
	if idx == len(two_que_t):
		continue
	a[i] = max(a[i], acc_max[idx])
print(*a)


n = int(input())
a = list(map(int, input().split()))
q = int(input())
s = [0 for i in range(len(a))]
f = [0 for i in range(q)]
for i in range(q):
	r = list(map(int, input().split()))
	if r[0] == 1:
		s[r[1] - 1] = i
		a[r[1] - 1] = r[2]
	else:
		f[i] = r[1]
for i in reversed(range(0, q - 1)):
	f[i] = max(f[i], f[i + 1])
for i in range(n):
	a[i] = max(a[i], f[s[i]])
print(*a)


n = int(input())
array = list(map(int, input().split()))
q = int(input())
d = {i: 0 for i in range(n)}
stack = []
for i in range(q):
	req = list(map(int, input().split()))
	if req[0] == 2:
		stack.append((req[1], i))
	else:
		p = req[1] - 1
		d[p] = i
		array[p] = req[2]
ans_i = [-1] * q
j = len(stack) - 1
max_of_stack = -1
for i in range(q - 1, -1, -1):
	if j > -1 and stack[j][1] >= i:
		max_of_stack = max(max_of_stack, stack[j][0])
		j -= 1
	ans_i[i] = max_of_stack
for p in range(n):
	if array[p] < ans_i[d[p]]:
		array[p] = ans_i[d[p]]
print(*array)


import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
query = [list(map(int, input().split())) for _ in range(Q)]
ans = [-1] * N
payoff = 0
for q in reversed(query):
	if q[0] == 1:
		if ans[q[1] - 1] == -1:
			ans[q[1] - 1] = max(payoff, q[2])
	else:
		payoff = max(payoff, q[1])
for i in range(N):
	if ans[i] == -1:
		ans[i] = max(payoff, A[i])
print(*ans)


[n] = [int(w) for w in input().split()]
a = [int(w) for w in input().split()]
[q] = [int(w) for w in input().split()]
o = [(x, 0) for x in a]
s = [0 for t in range(q + 1)]
for t in range(1, q + 1):
	(c, *xs) = [int(w) for w in input().split()]
	if c == 1:
		(p, x) = xs
		o[p - 1] = (x, t)
	else:
		[x] = xs
		s[t] = x
m = 0
for t in range(q, -1, -1):
	if s[t] > m:
		m = s[t]
	else:
		s[t] = m
print(*[max(x, s[t]) for (x, t) in o])


import math as mt
import collections as cc
import sys
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
(q,) = I()
ans = [-1] * n
que = []
for i in range(q):
	que.append(I())
tc = -1
for qq in que[::-1]:
	if qq[0] == 2:
		tc = max(tc, qq[1])
	elif ans[qq[1] - 1] == -1:
		ans[qq[1] - 1] = max(tc, qq[2])
for i in range(n):
	if ans[i] == -1:
		ans[i] = max(l[i], tc)
print(*ans)


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
n = I()
a = L()
q = I()
l = []
for i in range(q):
	l.append(L())
lab = [0] * n
max_inc = -1
for i in range(q - 1, -1, -1):
	ll = l[i]
	if ll[0] == 1 and lab[ll[1] - 1] == 0:
		lab[ll[1] - 1] = 1
		a[ll[1] - 1] = max(ll[2], max_inc)
	if ll[0] == 2:
		max_inc = max(max_inc, l[i][1])
for i in range(n):
	if lab[i] == 0:
		a[i] = max(a[i], max_inc)
print(*a)


import os, sys, atexit
from io import BytesIO, StringIO
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline
_OUTPUT_BUFFER = StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
n = int(input())
l = list(map(int, input().split()))
q = int(input())
arr = [0] * q
ind = [0] * n
for i in range(q):
	temp = list(map(int, input().split()))
	arr[i] = temp
	if temp[0] == 1:
		l[temp[1] - 1] = temp[2]
		ind[temp[1] - 1] = i
mx = [0] * q
m = 0
for i in range(q - 1, -1, -1):
	if arr[i][0] == 2:
		m = max(m, arr[i][1])
	mx[i] = m
for i in range(n):
	l[i] = max(l[i], mx[ind[i]])
print(*l)


n = int(input())
lis = list(map(int, input().split()))
lis = [[0, i] for i in lis]
k = int(input())
li = []
m = 0
for i in range(k):
	li.append(list(map(int, input().split())))
for i in range(k):
	if len(li[k - i - 1]) == 2:
		m = max(li[k - i - 1][1], m)
	elif lis[li[k - i - 1][1] - 1][0] == 0:
		lis[li[k - i - 1][1] - 1][0] = 1
		lis[li[k - i - 1][1] - 1][1] = max(m, li[k - i - 1][2])
for i in range(n):
	if lis[i][0] == 0:
		lis[i][1] = max(m, lis[i][1])
for i in range(n):
	print(lis[i][1], end=' ')


import bisect, sys
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
DBG = True and False
R = 10 ** 9 + 7

def ddprint(x):
	if DBG:
		print(x)
n = inn()
a = inl()
q = inn()
spend = []
pay = []
mx = 0
for i in range(q):
	c = inl()
	if c[0] == 1:
		spend.append((i, c[1], c[2]))
	else:
		pay.append((i, c[1]))
		if c[1] > mx:
			mx = c[1]
m = len(pay)
accpay = [(0, 0)] * (m + 1)
for i in range(m - 1, -1, -1):
	accpay[i] = (pay[i][0], max(accpay[i + 1][1], pay[i][1]))
accpay[m] = (999999999, 0)
b = [0] * n
for i in range(n):
	b[i] = max(a[i], mx)
for z in spend:
	idx = bisect.bisect_left(accpay, (z[0], z[1]))
	if idx >= m:
		b[z[1] - 1] = z[2]
	else:
		b[z[1] - 1] = max(z[2], accpay[idx][1])
for i in range(n):
	printn(('' if i == 0 else ' ') + str(b[i]))
print('')


n = int(input())
a = list(map(int, input().split()))
mark = [1 for i in range(n)]
query = []
q = int(input())
m = -1
for i in range(q):
	next = list(map(int, input().split()))
	if next[0] == 2:
		m = max(m, next[1])
	query.append(next)
mx = 0
for i in range(n):
	if a[i] < m:
		a[i] = m
for i in range(q - 1, -1, -1):
	next = query[i]
	if next[0] == 2:
		mx = max(mx, next[1])
	elif mark[next[1] - 1]:
		mark[next[1] - 1] = 0
		a[next[1] - 1] = next[2]
		if a[next[1] - 1] < mx:
			a[next[1] - 1] = mx
print(*a)


n = int(input())
init = [-1] + [int(x) for x in input().split()]
Q = [tuple(map(int, input().split())) for q in range(int(input()))]
p = [-1] * (n + 1)
qmax = 0
for i in range(1, len(Q) + 1):
	q1 = Q[-i]
	if q1[0] == 2:
		qmax = max(qmax, q1[1])
	elif p[q1[1]] == -1:
		p[q1[1]] = max(qmax, q1[2])
for i in range(1, n + 1):
	if p[i] == -1:
		p[i] = max(init[i], qmax)
print(*p[1:])


n = int(input())
a = [int(x) for x in input().split()]
dic = {}
for i in range(1, n + 1):
	dic[i] = [a[i - 1], 0]
q = int(input())
counter = 0
plane = []
for i in range(q):
	x = [int(x) for x in input().split()]
	if x[0] == 1:
		dic[x[1]] = [x[2], counter]
	else:
		plane.append(x[1])
		counter += 1
plane.reverse()
maxim = [0]
for item in plane:
	maxim.append(max(maxim[-1], item))
arr = []
for item in sorted(dic):
	arr.append(max(maxim[counter - dic[item][1]], dic[item][0]))
print(*arr)


import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def main():
	n = int(input())
	A = list(map(int, input().split()))
	q = int(input())
	Q = []
	for i in range(q):
		temp = list(map(int, input().split()))
		t = temp[0]
		if t == 1:
			(p, x) = (temp[1], temp[2])
			p -= 1
			Q.append((t, p, x))
		else:
			x = temp[1]
			Q.append((t, -1, x))
	Q.reverse()
	B = [-1] * n
	y = -1
	for (t, p, x) in Q:
		if t == 1:
			if B[p] == -1:
				B[p] = max(y, x)
		else:
			y = max(y, x)
	for (i, b) in enumerate(B):
		if b != -1:
			continue
		B[i] = max(A[i], y)
	print(*B)
main()


from sys import *
from math import *
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
q = int(stdin.readline())
m = []
mx = 0
mx1 = 0
j = 0
for i in range(q):
	x = list(map(int, stdin.readline().split()))
	m.append(x)
x = [0] * q
for i in range(q):
	if m[i][0] == 2:
		if mx < m[i][1]:
			mx = m[i][1]
			x[i] = mx
			mx = 0
		if mx1 < m[i][1]:
			mx1 = m[i][1]
mx = x[len(x) - 1]
for i in range(len(x) - 1, -1, -1):
	if x[i] != 0:
		if x[i] > mx:
			mx = x[i]
	x[i] = mx
for i in range(n):
	if a[i] < mx1:
		a[i] = mx1
for i in range(q):
	if m[i][0] == 1:
		a[m[i][1] - 1] = m[i][2]
		if a[m[i][1] - 1] < x[i]:
			a[m[i][1] - 1] = x[i]
print(*a)


import sys
input = sys.stdin.readline
n = int(input())
for _ in range(1):
	arr = list(map(int, input().split()))
	q = int(input())
	ql = []
	for iq in range(q):
		ql += [list(map(int, input().split()))]
	useful = []
	maxi = 0
	for i in range(q - 1, -1, -1):
		if ql[i][0] == 2:
			if ql[i][1] > maxi:
				useful += [ql[i]]
				maxi = ql[i][1]
		else:
			useful += [ql[i]]
	useful.reverse()
	flag = 0
	d = dict()
	maxi = 0
	for i in range(len(useful)):
		if useful[i][0] == 2:
			maxi = useful[i][1]
			if flag == 0:
				for j in range(len(arr)):
					if arr[j] < useful[i][1]:
						arr[j] = useful[i][1]
						flag = 1
			else:
				l = []
				for j in d:
					if arr[j] <= useful[i][1]:
						arr[j] = useful[i][1]
						l += [j]
				for j in l:
					del d[j]
		else:
			useful[i][1] -= 1
			if flag == 0:
				arr[useful[i][1]] = useful[i][2]
			else:
				arr[useful[i][1]] = useful[i][2]
				if useful[i][2] < maxi:
					d[useful[i][1]] = 1
	print(*arr)


from bisect import bisect_right
n = int(input())
A = list(map(int, input().split()))
B = [0] * n
C = []
for i in range(int(input())):
	w = list(map(int, input().split()))
	if w[0] == 1:
		A[w[1] - 1] = w[2]
		B[w[1] - 1] = i
	else:
		C.append((i, w[1]))
sC = [0]
for i in range(len(C) - 1, -1, -1):
	sC.append(max(sC[-1], C[i][1]))
sC = sC[::-1]
for i in range(n):
	A[i] = max(A[i], sC[bisect_right(C, (B[i], 0))])
print(*A)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
n = int(input())
a = list(map(int, input().split()))
q = int(input())
arr = []
for _ in range(q):
	arr.append(list(map(int, input().split())))
arr.reverse()
ans = [-1] * n
cur = 0
for i in arr:
	if i[0] == 2:
		cur = max(cur, i[1])
	elif ans[i[1] - 1] == -1:
		ans[i[1] - 1] = max(cur, i[2])
for i in range(n):
	if ans[i] == -1:
		ans[i] = max(a[i], cur)
print(*ans)


n = int(input())
a = list(map(int, input().split()))
q = int(input())
arr = []
for _ in range(q):
	arr.append(list(map(int, input().split())))
arr.reverse()
ans = [-1] * n
cur = 0
for i in arr:
	if i[0] == 2:
		cur = max(cur, i[1])
	elif ans[i[1] - 1] == -1:
		ans[i[1] - 1] = max(cur, i[2])
for i in range(n):
	if ans[i] == -1:
		ans[i] = max(a[i], cur)
print(*ans)


def naiveSolve(n):
	return

def main():
	n = int(input())
	a = [-1] + readIntArr()
	q = int(input())
	citizenLatestUpdateTime = [-1] * (n + 1)
	updatesSuffixMax = [-1] * (q + 1)
	for time in range(q):
		in_ = input().split()
		if len(in_) == 3:
			(p, x) = (int(in_[1]), int(in_[2]))
			a[p] = x
			citizenLatestUpdateTime[p] = time
		else:
			x = int(in_[1])
			updatesSuffixMax[time] = x
	for i in range(q - 2, -1, -1):
		updatesSuffixMax[i] = max(updatesSuffixMax[i], updatesSuffixMax[i + 1])
	for p in range(1, n + 1):
		a[p] = max(a[p], updatesSuffixMax[citizenLatestUpdateTime[p] + 1])
	oneLineArrayPrint(a[1:])
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(l, r):
	print('? {} {}'.format(l, r))
	sys.stdout.flush()
	return int(input())

def answerInteractive(x):
	print('! {}'.format(x))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
from math import gcd, floor, ceil
for _abc in range(1):
	main()


import sys
from collections import defaultdict
import heapq
input = sys.stdin.readline

def main():
	n = int(input())
	a = list(map(int, input().split()))
	q = int(input())
	events = []
	for _ in range(q):
		events.append(list(map(int, input().split())))
	max_x2_right = [-1] * len(events)
	pos = q - 1
	while pos >= 0:
		if events[pos][0] == 2:
			if pos < q - 1:
				max_x2_right[pos] = max(max_x2_right[pos + 1], events[pos][1])
			else:
				max_x2_right[pos] = events[pos][1]
		elif pos < q - 1:
			max_x2_right[pos] = max_x2_right[pos + 1]
		pos -= 1
	for i in range(n):
		a[i] = max(a[i], max_x2_right[0])
	for (i, e) in enumerate(events):
		if e[0] == 1:
			p = e[1] - 1
			a[p] = max(e[2], max_x2_right[i])
	print(*a)
main()


from sys import stdin
inp = stdin.readline
n = int(inp())
a = list(map(int, inp().split()))
q = int(inp())
cur_max = 0
max_after_query = [0] * q
queries = []
for i in range(q):
	op = list(map(int, inp().split()))
	queries.append(op)
for i in range(q - 1, -1, -1):
	if queries[i][0] == 2 and cur_max < queries[i][1]:
		cur_max = queries[i][1]
	max_after_query[i] = cur_max
for i in range(n):
	a[i] = max(cur_max, a[i])
for i in range(q):
	if queries[i][0] == 1:
		a[queries[i][1] - 1] = max(max_after_query[i], queries[i][2])
print(*a)


import sys
import bisect
import heapq
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
n = int(ri())
a = Ri()
s = set()
val = 0
arr = []
for _ in range(int(ri())):
	temp = Ri()
	arr.append(temp)
ans = [-1] * n
pre = [-1] * len(arr)
flag = [-1] * n
for i in range(len(arr) - 1, -1, -1):
	temp = arr[i]
	if temp[0] == 2:
		pre[i] = temp[1]
	elif flag[temp[1] - 1] == -1:
		flag[temp[1] - 1] = i
for i in range(len(arr) - 2, -1, -1):
	pre[i] = max(pre[i], pre[i + 1])
for i in range(n):
	if flag[i] != -1:
		a[i] = max(arr[flag[i]][2], pre[flag[i]])
	else:
		a[i] = max(a[i], pre[0])
print(*a)


from sys import stdin, stdout
n = int(stdin.readline())
a = [int(i) for i in stdin.readline().rstrip().split()]
marked = [False] * n
q = int(stdin.readline())
op = []
for i in range(q):
	op.append([int(i) for i in stdin.readline().rstrip().split()])
op.reverse()
max_so_far = 0
for o in op:
	if o[0] == 1:
		i = o[1] - 1
		v = o[2]
		if not marked[i]:
			marked[i] = True
			a[i] = max(max_so_far, v)
	else:
		v = o[1]
		max_so_far = max(max_so_far, v)
ans = ''
for i in range(n):
	if not marked[i]:
		marked[i] = True
		a[i] = max(a[i], max_so_far)
	stdout.write(str(a[i]))
	if i == n - 1:
		stdout.write('\n')
	else:
		stdout.write(' ')


import math
for _ in range(1):
	n = int(input())
	li = list(map(int, input().split()))
	ch = [0 for i in range(n)]
	d = []
	q = int(input())
	for i in range(q):
		l = list(map(int, input().split()))
		if l[0] == 1:
			li[l[1] - 1] = l[2]
			ch[l[1] - 1] = i + 1
			d.append(0)
		else:
			d.append(l[1])
	p = [0 for i in range(q + 1)]
	p[-1] = d[-1]
	for i in range(q - 1, -1, -1):
		p[i] = max(p[i + 1], d[i])
	e = []
	for i in range(n):
		e.append(max(li[i], p[ch[i]]))
	print(*e)


iYdqL = int
iYdqt = input
iYdqI = list
iYdqK = map
iYdqp = range
iYdqb = len
iYdqc = reversed
iYdqx = max
iYdqr = print
n = iYdqL(iYdqt())
a = iYdqI(iYdqK(iYdqL, iYdqt().split()))
q = iYdqL(iYdqt())
s = [0 for i in iYdqp(iYdqb(a))]
f = [0 for i in iYdqp(q)]
for i in iYdqp(q):
	r = iYdqI(iYdqK(iYdqL, iYdqt().split()))
	if r[0] == 1:
		s[r[1] - 1] = i
		a[r[1] - 1] = r[2]
	else:
		f[i] = r[1]
for i in iYdqc(iYdqp(0, q - 1)):
	f[i] = iYdqx(f[i], f[i + 1])
for i in iYdqp(n):
	a[i] = iYdqx(a[i], f[s[i]])
iYdqr(*a)


from sys import stdin
input = stdin.readline
n = int(input())
arr = list(map(int, input().split()))
m = int(input())
va = 0
q = []
ans = [-1] * n
for _ in range(m):
	q.append(list(map(int, input().split())))
for i in range(m - 1, -1, -1):
	if q[i][0] == 2:
		va = max(va, q[i][1])
	elif ans[q[i][1] - 1] == -1:
		ans[q[i][1] - 1] = max(va, q[i][2])
for i in range(n):
	if ans[i] == -1:
		ans[i] = max(va, arr[i])
print(*ans)


from sys import stdin
input = stdin.readline
n = int(input())
arr = list(map(int, input().split()))
q = int(input())
queries = [tuple(map(int, input().split())) for _ in range(q)][::-1]
(res, curr) = ([-1] * n, 0)
for q in queries:
	if q[0] == 1:
		if res[q[1] - 1] == -1:
			res[q[1] - 1] = max(q[2], curr)
	else:
		curr = max(curr, q[1])
for i in range(n):
	if res[i] == -1:
		res[i] = max(curr, arr[i])
res = [str(q) for q in res]
print(' '.join(res))


import sys
import math as mt
input = sys.stdin.buffer.readline
t = 1
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	q = int(input())
	l1 = []
	for ____ in range(q):
		l2 = list(map(int, input().split()))
		l1.append(l2)
	X = -1
	ind = {}
	ind1 = {}
	suff = [0] * (q + 1)
	pos = [0] * (n + 1)
	for i in range(q):
		if l1[i][0] == 1:
			pos[l1[i][1] - 1] = i
			l[l1[i][1] - 1] = l1[i][2]
	for i in range(q - 1, -1, -1):
		if l1[i][0] == 2:
			suff[i] = l1[i][1]
		suff[i] = max(suff[i + 1], suff[i])
	for i in range(n):
		if suff[pos[i]] > l[i]:
			l[i] = suff[pos[i]]
	print(*l)


import sys
read = sys.stdin.readline
n = int(read())
balance = list(map(int, read().split(' ')))
n_operations = int(read())
minis = []
next_mini = 0
changed_before = [0] * (len(balance) + 1)
for n_op in range(n_operations):
	operation = list(map(int, read().split(' ')))
	if operation[0] == 1:
		x = operation[1] - 1
		balance[x] = operation[2]
		changed_before[x] = next_mini
	elif operation[0] == 2:
		minis.append(operation[1])
		next_mini += 1
if len(minis) > 0:
	max_mini = minis[-1]
	for m in range(1, len(minis) + 1):
		max_mini = max(max_mini, minis[m * -1])
		minis[m * -1] = max_mini
	for x in range(len(balance)):
		cb = changed_before[x]
		if cb < next_mini:
			balance[x] = max(minis[cb], balance[x])
		balance[x] = str(balance[x])
else:
	for x in range(len(balance)):
		balance[x] = str(balance[x])
print(' '.join(balance))


n = int(input())
a = list(map(int, input().split()))
q = int(input())
last = [0 for i in range(n + 1)]
ubah = [0 for i in range(q + 1)]
for i in range(1, q + 1):
	k = input().split()
	if k[0] == '1':
		p = int(k[1])
		x = int(k[2])
		a[p - 1] = x
		last[p - 1] = i
	else:
		x = int(k[1])
		ubah[i] = x
for i in range(q - 1, -1, -1):
	ubah[i] = max(ubah[i + 1], ubah[i])
for i in range(n):
	print(max(a[i], ubah[last[i]]))


n = int(input())
a = list(map(int, input().split()))
q = int(input())
changes = [0] * q
for i in range(q):
	changes[-i - 1] = tuple(map(int, input().split()))
final = [-1] * n
curr = 0
for guy in changes:
	if guy[0] == 1:
		if final[guy[1] - 1] == -1:
			final[guy[1] - 1] = max(guy[2], curr)
	else:
		curr = max(curr, guy[1])
for i in range(n):
	if final[i] == -1:
		final[i] = max(curr, a[i])
final = [str(guy) for guy in final]
print(' '.join(final))


import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
answers = [-1] * n
last_all_update = [-1, 0]
updates = [[1, i + 1, a[i]] for i in range(n)]
q = int(input())
for i in range(1, q + 1):
	updates.append(list(map(int, input().split())))
curr_mx = 0
for i in range(len(updates) - 1, -1, -1):
	a = updates[i]
	if a[0] == 1:
		if answers[a[1] - 1] == -1:
			answers[a[1] - 1] = max(curr_mx, a[2])
	else:
		curr_mx = max(curr_mx, a[1])
print(*answers)


n = int(input())
a = [[int(q), 0] for q in input().split()]
k = int(input())
(was, changes) = (0, [])
for _ in range(k):
	s = list(map(int, input().split()))
	if s[0] == 1:
		a[s[1] - 1] = [s[2], was]
	else:
		changes.append(s[1])
		was += 1
max1 = [-1]
for q in range(len(changes) - 1, -1, -1):
	max1.append(max(max1[-1], changes[q]))
max1.reverse()
print(*[max(q[0], max1[q[1]]) for q in a])


import sys
input = sys.stdin.readline
prnt = sys.stdout.write
n = int(input())
a = list(map(int, input().split()))
q = int(input())
ls = []
last = [-1] * n
for i in range(q):
	x = list(map(int, input().split()))
	ls.append(x)
	if x[0] == 1:
		last[x[1] - 1] = i
mxsf = [-1] * (q + 1)
for i in range(q - 1, -1, -1):
	if ls[i][0] == 2:
		mxsf[i] = ls[i][1]
	mxsf[i] = max(mxsf[i], mxsf[i + 1])
for i in range(n):
	if last[i] == -1:
		a[i] = max(a[i], mxsf[0])
	else:
		a[i] = max(mxsf[last[i]], ls[last[i]][2])
print(' '.join([str(i) for i in a]))


from sys import stdin, stdout

class Stree:

	def __init__(self, f, n, default, init_data):
		self.ln = 2 ** (n - 1).bit_length()
		self.data = [default] * (self.ln * 2)
		self.f = f
		for (i, d) in init_data:
			self.data[self.ln + i] = d
		for j in range(self.ln - 1, -1, -1):
			self.data[j] = f(self.data[j * 2], self.data[j * 2 + 1])

	def get(self, i, j):

		def _get(l, r, p):
			if i <= l and j >= r:
				return self.data[p]
			else:
				m = (l + r) // 2
				if j <= m:
					return _get(l, m, p * 2)
				elif i >= m:
					return _get(m, r, p * 2 + 1)
				else:
					return self.f(_get(l, m, p * 2), _get(m, r, p * 2 + 1))
		return _get(0, self.ln, 1)

def input():
	return next(stdin)
n = int(input())
aa = list(map(int, input().split()))
q = int(input())
fixTime = [0] * n
payouts = []
for i in range(q):
	e = list(map(int, input().split()))
	if e[0] == 1:
		j = e[1] - 1
		aa[j] = e[2]
		fixTime[j] = i
	else:
		payouts.append((i, e[1]))
stree = Stree(max, q, 0, payouts)
for i in range(n):
	aa[i] = max(aa[i], stree.get(fixTime[i], q))
print(*aa)


import sys
import math
input = sys.stdin.readline
n = int(input())
arr = list(map(int, input().split()))
q = int(input())
glob = []
chg = []
iss = [0] * n
ind = [0] * n
for i in range(q):
	l = list(map(int, input().split()))
	if l[0] == 1:
		if iss[l[1] - 1] == 0:
			chg.append([i, l[1] - 1, l[2]])
			ind[l[1] - 1] = len(chg) - 1
			iss[l[1] - 1] = 1
		else:
			chg[ind[l[1] - 1]][0] = i
			chg[ind[l[1] - 1]][2] = l[2]
	else:
		glob.append([l[1], i])
glob.sort(reverse=True)
chg.sort()
if len(glob) > 0:
	for i in range(n):
		if iss[i] == 0:
			arr[i] = max(arr[i], glob[0][0])
ptr = 0
for i in range(len(glob)):
	while ptr < len(chg) and chg[ptr][0] < glob[i][1]:
		maxx = max(glob[i][0], chg[ptr][2])
		arr[chg[ptr][1]] = maxx
		ptr += 1
for i in range(ptr, len(chg)):
	arr[chg[i][1]] = chg[i][2]
print(*arr)


(citizensCount, citizens, requestsCount) = (int(input()), [*map(int, input().split())], int(input()))
operations = []
for _ in range(requestsCount):
	(type, *cmd) = map(int, input().split())
	operations.append((type, cmd))
wagesChanges = [-1 for _ in range(citizensCount)]
secondTypeMax = -1
for (type, op) in reversed(operations):
	if type == 2:
		secondTypeMax = max(secondTypeMax, op[0])
	else:
		(citizenIndex, newIncome) = op
		citizenIndex -= 1
		if wagesChanges[citizenIndex] == -1:
			wagesChanges[citizenIndex] = max(newIncome, secondTypeMax)
print(' '.join((str(b if b != -1 else max(secondTypeMax, a)) for (a, b) in zip(citizens, wagesChanges))))


import sys
input = sys.stdin.buffer.readline

def solution():
	n = int(input())
	l = list(map(int, input().split()))
	m = -1
	a = [-1] * n
	q = []
	for _ in range(int(input())):
		t = list(map(int, input().split()))
		q.append(t)
	for t in q[::-1]:
		if t[0] == 1 and a[t[1] - 1] == -1:
			a[t[1] - 1] = max(t[2], m)
		if t[0] == 2:
			m = max(t[1], m)
	for i in range(n):
		if a[i] == -1:
			a[i] = max(l[i], m)
	print(*a)
solution()


n = int(input())
a = [int(s) for s in input().split()]
q = int(input())
b = [None] * n
rnd = 0
xs = []
for i in range(q):
	qi = [int(s) for s in input().split()]
	if qi[0] == 1:
		b[qi[1] - 1] = (qi[2], rnd)
	else:
		xs.append(qi[1])
		rnd += 1
maxx = 0
if xs:
	maxx = xs[-1]
	for i in range(len(xs) - 2, -1, -1):
		if xs[i] < maxx:
			xs[i] = maxx
		else:
			maxx = xs[i]
xs.append(0)
for i in range(n):
	if not b[i]:
		a[i] = max(maxx, a[i])
	else:
		a[i] = max(b[i][0], xs[b[i][1]])
print(*a)


from heapq import *
import sys

def get_ints():
	return map(int, sys.stdin.readline().split())
n = int(input())
arr = list(map(int, input().split()))
arr_q = []
for i in range(int(input())):
	arr_q.append(list(get_ints()))
cur = 0
ans = [-1] * n
for i in arr_q[::-1]:
	if i[0] == 2:
		cur = max(cur, i[1])
	elif ans[i[1] - 1] == -1:
		ans[i[1] - 1] = max(cur, i[2])
for i in range(n):
	if ans[i] == -1:
		ans[i] = max(cur, arr[i])
print(*ans)


from collections import deque
n = int(input())
money = list(map(int, input().split()))
money_t = [0] * len(money)
x_list = []
q = int(input())
for q_ind in range(q):
	line = list(map(int, input().split()))
	if line[0] == 2:
		x = line[1]
		x_list.append(x)
	if line[0] == 1:
		(_, p, mon) = line
		money[p - 1] = mon
		money_t[p - 1] = len(x_list)
x_list_suffix = deque()
max_suff = 0
x_list_suffix.appendleft(max_suff)
for k in reversed(range(len(x_list))):
	max_suff = max(max_suff, x_list[k])
	x_list_suffix.appendleft(max_suff)
for k in range(len(money)):
	money[k] = max(money[k], x_list_suffix[money_t[k]])
print(*money)


import sys
n = int(sys.stdin.readline())
a = [int(i) for i in sys.stdin.readline().split()]
q = int(sys.stdin.readline())
arr = [0] * n
upd = [-2] * q
for w in range(q):
	event = [int(j) for j in sys.stdin.readline().split()]
	if event[0] == 1:
		p = event[1]
		x = event[2]
		a[p - 1] = x
		arr[p - 1] = w
	else:
		x = event[1]
		upd[w] = x
for h in range(q - 2, -1, -1):
	upd[h] = max(upd[h], upd[h + 1])
for g in range(n):
	a[g] = max(a[g], upd[arr[g]])
	a[g] = str(a[g])
print(' '.join(a))


N = int(input())
List = [int(x) for x in input().split()]
query = []
q = int(input())
for i in range(q):
	x = [int(x) for x in input().split()]
	query.append(x)
second = [-1] * q
if query[q - 1][0] == 2:
	second[q - 1] = query[q - 1][1]
for i in range(q - 2, -1, -1):
	if query[i][0] == 2:
		second[i] = max(second[i + 1], query[i][1])
	else:
		second[i] = second[i + 1]
first = [-1] * N
for i in range(q):
	if query[i][0] == 1:
		first[query[i][1] - 1] = i
for i in range(N):
	if first[i] != -1:
		List[i] = query[first[i]][2]
		List[i] = max(List[i], second[first[i]])
	elif second[0] != -1:
		List[i] = max(List[i], second[0])
print(*List)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	q = int(input())
	dict1 = {}
	max1 = []
	for i in range(q):
		temp = list(map(int, input().split()))
		if len(temp) == 2:
			max1.append(temp[1])
		else:
			dict1[temp[1]] = [temp[2], i]
			max1.append(-1)
	maxVal = max1[-1]
	for i in range(q - 2, -1, -1):
		if max1[i] > maxVal:
			maxVal = max1[i]
		elif max1[i] < maxVal:
			max1[i] = maxVal
	for i in range(n):
		if i + 1 in dict1:
			arr[i] = max(dict1[i + 1][0], max1[dict1[i + 1][1]])
		else:
			arr[i] = max(arr[i], max1[0])
	for x in arr:
		print(x, end=' ')
	print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
a = list(map(int, input().split()))
d = {i + 1: (x, 0) for (i, x) in enumerate(a)}
q = int(input())
event = [-1] * (q + 1)
for i in range(q):
	get = list(map(int, input().split()))
	if len(get) == 2:
		(t, val) = get
		event[i + 1] = val
	else:
		(t, p, x) = get
		d[p] = (x, i + 1)
for i in range(q - 1, -1, -1):
	event[i] = max(event[i], event[i + 1])
for (k, (val, time)) in d.items():
	if val < event[time]:
		d[k] = event[time]
	else:
		d[k] = val
s = ''
for i in range(1, n + 1):
	s += str(d[i]) + ' '
print(s)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
vals = list(map(int, input().split()))
check = [0 for s in range(n)]
order = []
q = int(input())
for s in range(q):
	info = input().split()
	order.append(info)
lpy = 0
for s in range(q - 1, -1, -1):
	if order[s][0] == '1':
		ind = int(order[s][1])
		pay = int(order[s][2])
		if check[ind - 1] == 0:
			vals[ind - 1] = max(lpy, pay)
			check[ind - 1] = 1
	else:
		lpy = max(lpy, int(order[s][1]))
for s in range(n):
	if check[s] == 0:
		vals[s] = max(lpy, vals[s])
print(*vals)


n = int(input())
l = list(map(int, input().split()))
q = int(input())
ql = []
ans = [-1] * n
m = 0
for _ in range(q):
	ql.append(tuple(map(int, input().split())))
for i in range(q - 1, -1, -1):
	if ql[i][0] == 2:
		m = max(m, ql[i][1])
	elif ans[ql[i][1] - 1] == -1:
		ans[ql[i][1] - 1] = max(m, ql[i][2])
for i in range(n):
	if ans[i] == -1:
		ans[i] = max(m, l[i])
print(*ans)


from sys import stdin
input = stdin.readline
n = int(input())
money = list(map(int, input().split(' ')))
m = int(input())
tmp = 0
up = [0 for i in range(m)]
last = [0 for i in range(n)]
for i in range(m):
	req = list(map(int, input().split(' ')))
	if req[0] == 2:
		up[i] = req[1]
	else:
		money[req[1] - 1] = req[2]
		last[req[1] - 1] = i
for i in range(m - 2, -1, -1):
	up[i] = max(up[i], up[i + 1])
for i in range(n):
	money[i] = max(money[i], up[last[i]])
for i in range(n):
	print(money[i], end=' ')


import sys
n = int(input())
a = [int(i) for i in input().split(' ')]
lasts = [0] * n
q = int(input())
mins = []
trs = []
for i in range(0, q):
	tr = [int(i) for i in sys.stdin.readline().rstrip().split(' ')]
	if tr[0] == 1:
		a[tr[1] - 1] = tr[2]
		lasts[tr[1] - 1] = i
	trs.append(tr)
ct = 0
for i in range(len(trs) - 1, -1, -1):
	if trs[i][0] == 2:
		if ct == 0:
			mins.append(trs[i][1])
		else:
			mins.append(max(mins[-1], trs[i][1]))
	elif ct == 0:
		mins.append(0)
	else:
		mins.append(mins[-1])
	ct += 1
mins = mins[::-1]
carr = []
for i in range(0, len(a)):
	carr.append(max(a[i], mins[lasts[i]]))
print(' '.join([str(i) for i in carr]))


from sys import stdin
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
input()
t = [True] * n
x = 0
for inn in stdin.readlines()[::-1]:
	l = list(map(int, inn.split()))
	i = l[1] - 1
	if len(l) == 3 and t[i]:
		a[i] = max(l[2], x)
		t[i] = False
	elif len(l) == 2:
		x = max(x, l[1])
for i in range(n):
	if t[i]:
		a[i] = max(a[i], x)
print(*a)


import sys
input = sys.stdin.readline
from bisect import bisect_left as bl
N = int(input())
A = [int(a) for a in input().split()]
Q = int(input())
L = [-1] * N
X = []
Y = []
for i in range(Q):
	t = [int(a) for a in input().split()]
	if t[0] == 1:
		(p, x) = (t[1] - 1, t[2])
		A[p] = x
		L[p] = i
	else:
		x = t[1]
		while len(Y) and Y[-1] <= x:
			X.pop()
			Y.pop()
		X.append(i)
		Y.append(x)
for i in range(N):
	j = bl(X, L[i])
	if j < len(X):
		A[i] = max(A[i], Y[j])
print(*A)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
qq = int(input())
queries = [list(map(int, input().split())) for _ in range(qq)]
queries.reverse()
ans = [-1] * n
payoff = 0
for q in queries:
	if q[0] == 1:
		if ans[q[1] - 1] == -1:
			ans[q[1] - 1] = max(payoff, q[2])
	else:
		payoff = max(payoff, q[1])
for i in range(n):
	if ans[i] == -1:
		ans[i] = max(payoff, a[i])
print(*ans)


import math
import pdb
n = int(input())
a = list(map(int, input().strip().split()))
q = int(input())
change = {}
query = []
add = [0] * (q + 2)
ba = [0] * n
for i in range(q):
	query.append(list(map(int, input().strip().split())))
for i in range(q):
	if query[i][0] == 1:
		if query[i][1] - 1 in change:
			change[query[i][1] - 1] = query[i][2]
		else:
			change[query[i][1] - 1] = query[i][2]
		ba[query[i][1] - 1] = i
for i in range(q - 1, -1, -1):
	if query[i][0] == 2:
		add[i] = max(add[i + 1], query[i][1])
	else:
		add[i] = add[i + 1]
for i in range(n):
	if i in change:
		a[i] = max(change[i], add[ba[i]])
	else:
		a[i] = max(a[i], add[0])
	print(a[i], end=' ')


n = int(input())
a = list(map(int, input().split()))
m = int(input())
o = [list(map(int, input().split())) for _ in range(m)]
b = [0] * m
x = 0
for i in range(m - 1, -1, -1):
	if o[i][0] == 2:
		x = max(x, o[i][1])
	b[i] = x
for i in range(n):
	a[i] = max(a[i], b[0])
for i in range(m):
	if o[i][0] == 1:
		a[o[i][1] - 1] = max(o[i][2], b[i])
print(*a)


import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
q = int(input())
qq = []
for _ in range(q):
	qq.append(tuple(map(int, input().split())))
qq.reverse()
ans = [-1] * n
cur = 0
for t in qq:
	if t[0] == 2:
		cur = max(cur, t[1])
	elif ans[t[1] - 1] == -1:
		ans[t[1] - 1] = max(cur, t[2])
for i in range(n):
	if ans[i] == -1:
		ans[i] = max(a[i], cur)
print(*ans)


n = int(input().strip())
a = list(map(int, input().split()))
q = int(input().strip())
queries = []
last_balance = [-1] * n
last_balance_id = [-1] * n
for i in range(q):
	query = list(map(int, input().split()))
	queries.append(query)
	if query[0] == 1:
		p = query[1] - 1
		last_balance[p] = query[2]
		last_balance_id[p] = i
max_pay = [0] * (q + 1)
for i in range(q - 1, -1, -1):
	query = queries[i]
	if query[0] == 2:
		max_pay[i] = max(query[1], max_pay[i + 1])
	else:
		max_pay[i] = max_pay[i + 1]
for p in range(n):
	if last_balance_id[p] >= 0:
		id = last_balance_id[p]
		pay = max_pay[id]
		a[p] = max(pay, last_balance[p])
	else:
		a[p] = max(a[p], max_pay[0])
print(' '.join([str(x) for x in a]))


def main():
	import sys, math

	def data():
		return sys.stdin.readline().strip()

	def mdata():
		return list(map(int, data().split()))

	def out(*var, end='\n'):
		sys.stdout.write(' '.join(map(str, var)) + end)
	INF = int(1000000000.0)
	mod = int(1000000000.0) + 7

	def construct_sum(a, n):
		for i in range(n):
			segtree[n + i] = a[i]
		for i in range(n - 1, 0, -1):
			segtree[i] = max(segtree[2 * i], segtree[2 * i + 1])

	def update_sum(pos, x):
		pos += n - 1
		segtree[pos] = x
		while pos > 1:
			pos >>= 1
			segtree[pos] = max(segtree[2 * pos], segtree[2 * pos + 1])

	def getSum(l, r, n):
		l += n - 1
		r += n - 1
		s = 0
		while l <= r:
			if l & 1:
				s = max(s, segtree[l])
				l += 1
			if r + 1 & 1:
				s = max(s, segtree[r])
				r -= 1
			l >>= 1
			r >>= 1
		return s
	n = int(data())
	a = list(mdata())
	v = [0] * n
	x = []
	cnt = 0
	for i in range(int(data())):
		l = mdata()
		if len(l) == 2:
			x.append(l[1])
			cnt += 1
		else:
			a[l[1] - 1] = l[2]
			v[l[1] - 1] = cnt
	segtree = [0] * (2 * len(x))
	construct_sum(x, len(x))
	ans = [0] * n
	for i in range(n):
		ans[i] = max(a[i], getSum(v[i] + 1, len(x), len(x)))
	print(*ans)
main()


import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
import math
from bisect import bisect_left
n = getN()
nums = getList()
q = getN()
queries = []
for i in range(q):
	queries.append(getList())
used = [0 for i in range(n)]
ans = [0 for i in range(n)]
hosyo = 0
for qr in queries[::-1]:
	if qr[0] == 2:
		if hosyo < qr[1]:
			hosyo = qr[1]
	else:
		tgt = qr[1] - 1
		if not used[tgt]:
			ans[tgt] = max(hosyo, qr[2])
			used[tgt] = 1
print(*[num if used[i] != 0 else max(hosyo, nums[i]) for (i, num) in enumerate(ans)])


import sys
input = sys.stdin.readline
for nt in range(1):
	n = int(input())
	l = list(map(int, input().split()))
	q = int(input())
	last = {}
	maxx = [0] * q
	t2 = []
	for i in range(q):
		temp = list(map(int, input().split()))
		if temp[0] == 1:
			last[temp[1]] = (temp[2], i)
		else:
			t2.append((temp[1], i))
	if len(t2) > 0:
		j = len(t2) - 1
		m = -1
		for i in range(q - 1, -1, -1):
			if i > t2[j][1]:
				maxx[i] = m
			else:
				maxx[i] = max(t2[j][0], m)
				j -= 1
				m = maxx[i]
	ans = []
	for i in range(n):
		if i + 1 in last:
			ans.append(max(last[i + 1][0], maxx[last[i + 1][1]]))
		else:
			ans.append(max(maxx[0], l[i]))
	print(*ans)


from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')

def solve():
	n = ii()
	a = li()
	q = ii()
	p = [0] * n
	suff = [0] * q
	for i in range(q):
		tc = li()
		if tc[0] == 1:
			x = tc[1]
			y = tc[2]
			a[x - 1] = y
			p[x - 1] = i
		else:
			suff[i] = tc[1]
	for i in range(q - 2, -1, -1):
		suff[i] = max(suff[i], suff[i + 1])
	for i in range(n):
		x = p[i]
		mx = suff[x]
		if a[i] < mx:
			a[i] = mx
	print(*a)
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
solve()


R = lambda : map(int, input().split())
n = int(input())
a = list(R())
q = int(input())
p = []
ax = [-1] * n
for _ in range(q):
	p.append(list(R()))
temp = 0
for i in range(q - 1, -1, -1):
	if p[i][0] == 2:
		temp = max(temp, p[i][1])
	elif ax[p[i][1] - 1] == -1:
		ax[p[i][1] - 1] = max(temp, p[i][2])
for i in range(0, n):
	if ax[i] == -1:
		print(max(temp, a[i]), end=' ')
	else:
		print(ax[i], end=' ')


from sys import stdin, stdout
for _ in range(1):
	n = int(stdin.readline())
	last = [0] * n
	a = list(map(int, stdin.readline().split()))
	update = []
	qq = int(stdin.readline())
	for q in range(qq):
		pair = list(map(int, stdin.readline().split()))
		if pair[0] == 2:
			update += [pair[1]]
		else:
			last[pair[1] - 1] = q
			a[pair[1] - 1] = pair[2]
			update += [0]
	for i in range(qq - 2, -1, -1):
		update[i] = max(update[i + 1], update[i])
	for i in range(n):
		a[i] = max(a[i], update[last[i]])
	print(*a)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // lcm(a, b)
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush
from bisect import bisect_left

def main():
	n = N()
	arr = RLL()
	q = N()
	rec = []
	recp = []
	alp = [-1] * (n + 1)
	for i in range(q):
		now = RLL()
		if now[0] == 1:
			(p, x) = now[1:]
			arr[p - 1] = x
			alp[p - 1] = i
		else:
			x = now[1]
			while rec and x >= rec[-1]:
				rec.pop()
				recp.pop()
			rec.append(x)
			recp.append(i)
	if len(rec) == 0:
		print(*arr)
		exit()
	for i in range(n):
		p = bisect_left(recp, alp[i])
		if p < len(rec):
			arr[i] = max(arr[i], rec[p])
	print(*arr)
main()


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import sys
import string
import random
from typing import List
sys.setrecursionlimit(99999)
n = int(input())
arr = [0] + list(map(int, input().split()))
q = int(input())
chg = [[-1, x] for x in arr]
nor = []
for i in range(q):
	ops = list(map(int, input().split()))
	if ops[0] == 1:
		chg[ops[1]] = [i, ops[2]]
	else:
		nor.append([i, ops[1]])
nor.append([q + 1, -1])
for i in range(len(nor) - 2, -1, -1):
	nor[i][1] = max(nor[i][1], nor[i + 1][1])
for i in range(1, n + 1):
	(pos, x) = chg[i]
	j = bisect.bisect_left(nor, [pos, x])
	print(max(x, nor[j][1]), end=' ')
print()


import sys
in_file = sys.stdin
n = int(in_file.readline().strip())
A = list(map(int, in_file.readline().strip().split()))
q = int(in_file.readline().strip())
flood = []
last = [0 for a in A]
for i in range(q):
	t = list(map(int, in_file.readline().strip().split()))
	if t[0] == 1:
		A[t[1] - 1] = t[2]
		last[t[1] - 1] = i
		flood.append(0)
	else:
		flood.append(t[1])
flood_max = [flood[-1]]
for i in range(len(flood) - 1):
	flood_max.append(max(flood_max[-1], flood[len(flood) - i - 2]))
flood_max.reverse()
for i in range(len(A)):
	A[i] = max(A[i], flood_max[last[i]])
sys.stdout.write(' '.join(map(str, A)))
sys.stdout.flush()


n = int(input())
arr = list(map(int, input().rstrip().split()))
q = int(input())
events = []
for i in range(q):
	a = list(map(int, input().rstrip().split()))
	events.append(a)
changes = {}
for i in range(q):
	if events[i][0] == 1:
		if events[i][1] not in changes.keys():
			changes.update({events[i][1]: i})
		else:
			changes[events[i][1]] = i
max_payoff = {}
for i in changes.keys():
	max_payoff.update({changes[i]: 0})
max_pay = 0
for i in range(q - 1, -1, -1):
	if events[i][0] == 2:
		if max_pay < events[i][1]:
			max_pay = events[i][1]
	if i in max_payoff.keys():
		max_payoff[i] = max_pay
for i in range(1, len(arr) + 1):
	if i in changes.keys():
		arr[i - 1] = max(max_payoff[changes[i]], events[changes[i]][2])
	elif arr[i - 1] < max_pay:
		arr[i - 1] = max_pay
for i in arr:
	print(i, end=' ')
print()


n = int(input())
a = list(map(int, input().split()))
q = int(input())
r1 = [-1] * q
r2 = [-1] * q
for i in range(q):
	ne = list(map(int, input().split()))
	if ne[0] == 1:
		p = ne[1] - 1
		t = ne[2]
		r1[i] = [p, t]
	else:
		r2[i] = ne[1]
b = -1
for i in range(q - 1, -1, -1):
	b = max(b, r2[i])
	r2[i] = b
m = r2[0]
for i in range(n):
	a[i] = max(a[i], m)
for i in range(q):
	if r1[i] == -1:
		pass
	else:
		a[r1[i][0]] = max(r1[i][1], r2[i])
print(*a)


n = int(input())
a = [int(X) for X in input().split()]
vis = [0] * n
c = 0
tt = []
for j in range(int(input())):
	s = input().split()
	if s[0] == '1':
		(p, x) = map(int, s[1:])
		a[p - 1] = x
		vis[p - 1] = c
	else:
		tt.append(int(s[1]))
		c += 1
for j in range(len(tt) - 2, -1, -1):
	tt[j] = max(tt[j], tt[j + 1])
tt = tt + [0]
print(*[max(a[i], tt[vis[i]]) for i in range(n)])


import sys
input = sys.stdin.readline

def construct(array, cur_pos, tree, start, end):
	if start == end:
		tree[cur_pos] = array[start]
	else:
		mid = (start + end) // 2
		tree[cur_pos] = max(construct(array, 2 * cur_pos + 1, tree, start, mid), construct(array, 2 * cur_pos + 2, tree, mid + 1, end))
	return tree[cur_pos]

def query(start, end, l, r, index, tree):
	if l <= start and r >= end:
		return tree[index]
	if end < l or start > r:
		return -1
	mid = (start + end) // 2
	return max(query(start, mid, l, r, 2 * index + 1, tree), query(mid + 1, end, l, r, 2 * index + 2, tree))
n = int(input())
l = list(map(int, input().split()))
q = int(input())
last_query = [-1] * n
queries = [-1] * q
for i in range(q):
	l1 = list(map(int, input().split()))
	if l1[0] == 1:
		index = l1[1] - 1
		value = l1[2]
		l[index] = value
		last_query[index] = i
	else:
		queries[i] = l1[1]
tree = [0] * (5 * q)
array = queries
construct(array, 0, tree, 0, q - 1)
for i in range(n):
	temp = last_query[i]
	if temp + 1 < q:
		q1 = query(0, q - 1, temp + 1, q - 1, 0, tree)
		l[i] = max(q1, l[i])
print(*l, sep=' ')


from collections import deque, defaultdict
from math import sqrt, ceil, factorial, floor
import sys
import copy

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
maxn = 10 ** 5 + 1
n = int(input())
a = get_array()
q = int(input())
mya = [-1] * n
c = []
for i in range(q):
	b = get_array()
	if b[0] == 1:
		mya[b[1] - 1] = i
	c.append(b)
myb = [-1] * len(c)
for i in range(len(c) - 1, -1, -1):
	if c[i][0] == 2:
		myb[i] = max(myb[i], c[i][1])
	if i + 1 <= len(c) - 1:
		myb[i] = max(myb[i + 1], myb[i])
ans = []
for i in range(n):
	if mya[i] == -1:
		ans.append(max(a[i], myb[0]))
	else:
		ind = mya[i]
		my = c[ind][2]
		ans.append(max(my, myb[ind]))
print(*ans)


import os, sys
from io import IOBase, BytesIO
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'
n = int(input())
from bisect import bisect_right as br
a = list(map(int, input().split()))
q = int(input())
up = [-1 for i in range(n)]
inc = []
ind = []
for i in range(q):
	d = list(map(int, input().split()))
	if d[0] == 1:
		a[d[1] - 1] = d[2]
		up[d[1] - 1] = i
	else:
		inc.append(d[1])
		ind.append(i)

def build():
	nn = len(inc)
	N = 1
	while N < nn:
		N <<= 1
	st = [-1 for i in range(N << 1)]
	for i in range(nn):
		st[i + N] = inc[i]
	for i in range(N - 1, 0, -1):
		st[i] = max(st[i << 1], st[i << 1 | 1])
	return [st, N]
(st, N) = build()

def qr(l, r=N):
	l += N
	r += N
	ans = 0
	while l < r:
		if l & 1:
			ans = max(ans, st[l])
			l += 1
		if r & 1:
			r -= 1
			ans = max(ans, st[r])
		l >>= 1
		r >>= 1
	return ans
for i in range(n):
	u = up[i]
	j = br(ind, u)
	an = qr(j)
	if an > a[i]:
		a[i] = an
print(*a)