cswork / OAOpen practice workspace

DoorDashOA #1

Adjust Prices

Estimated MediumJudge-ready

Topics (AI-labelled)Prefix & RangesIn-place Arrays

Execute the operations in order: 1 x v changes the price of item x to v; 2 v 0 raises every price below v to v. The original problem writes the second type of operation as 2 v v; because the last two fields duplicate each other, this site normalizes it to 2 v 0, and the second field v still denotes the global lower bound.

Input

n q (1≤n,q≤100000), the initial price array, then q lines of operations. Prices are in 1..10⁹, and point indices are 1-based.

Output

Output the final prices.

Example 1

Input:

3 3
3 1 8
2 5 0
1 2 2
2 7 0

Output:

7 7 8

Example 2

Input:

1 2
1
1 1 9
2 4 0

Output:

9

Example 3

Input:

2 2
10 20
2 10 0
1 1 1

Output:

1 20

Editorial

Loading solution…